Using the Docker registry
As an alternative to reusing the Docker daemon, you may enable the registry addon to push images directly into registry.
Steps are as follows:
For illustration purpose, we will assume that minikube VM has one of the ip from
192.168.39.0/24 subnet. If you have not overridden these subnets as per networking guide, you can find out default subnet being used by minikube for a specific OS and driver combination here which is subject to change. Replace
192.168.39.0/24 with appropriate values for your environment wherever applicable.
Ensure that docker is configured to use
192.168.39.0/24 as insecure registry. Refer here for instructions.
192.168.39.0/24 is enabled as insecure registry in minikube. Refer here for instructions..
Enable minikube registry addon:
minikube addons enable registry
Build docker image and tag it appropriately:
docker build --tag $(minikube ip):5000/test-img .
Push docker image to minikube registry:
docker push $(minikube ip):5000/test-img
Now run it in minikube:
kubectl run test-img --image=$(minikube ip):5000/test-img
192.168.39.0/24 is not enabled as insecure registry in minikube, then:
kubectl run test-img --image=localhost:5000/test-img