How to connect docker host inside Minikube

4/11/2021

I want to deploy K8s artifacts to minikube which it's docker images are not available on Docker Hub. Images are build locally when I build my project.

When I build my project the images are build locally. But I can't deploy the K8s artifacts to minikube because the images are simply not available locally to docker host inside minikube.

Therefore I need a method to build my project inside minikube's docker host

-- Rumesh Madhusanka
docker
docker-registry
kubernetes
minikube

1 Answer

4/11/2021

You can use eval $(minikube docker-env) to connect to the docker daemon from minikube (in your current terminal). Afterwards you can use any docker command which will run against the docker daemon from minikube.

So you can use docker build ..., which will store the images in the registry from minikube.

e.g.

eval $(minikube docker-env)
docker build -t my-app-image .

Documentation can be found at the minkube doc

-- chresse
Source: StackOverflow