I'm feeling pretty stupid here. I want K8s to pull Docker images from a local registry to ensure my development cycle is as fast as possible.
I have set up the local registry per the instructions and am using an insecure registry. I have pushed images to it, and have confirmed they reside in the registry by looking inside it using VS Code's Docker extension:
I didn't really know whether to use localhost
, $MACHINE_NAME
, or $LOCAL_IP_ADDRESS
, so I did all three.
I can successfully pull an image from these registries via the command line. However, when K8s (running via minikube) attempts to pull, it fails:
Failed to pull image "localhost:5000/service1": rpc error: code = Unknown desc = Error response from daemon: Get http://localhost:5000/v2/: dial tcp 127.0.0.1:5000: connect: connection refused
Why is this and how can I rectify?
localhost
you have to use the ip address that map minikube to host machine's localhost. This is generally10.0.2.2
or10.0.2.15
based on your vm driver. You can determine using runningifconfig
inside minikube and check ip in form of10.0.2.*
This github issue might help: github.com/kubernetes/minikube/issues/2735 – Emruz Hossain