kubernetes cannot pull local image kubernetes cannot pull local image kubernetes kubernetes

kubernetes cannot pull local image


So you have the image on your machine aready. It still tries to pull the image from Docker Hub, however, which is likely not what you want on your single-machine setup. This is happening because the latest tag sets the imagePullPolicy to Always implicitly. You can try setting it to IfNotPresent explicitly or change to a tag other than latest. – Timo Reimann Apr 28 at 7:16

For some reason Timo Reimann did only post this above as a comment, but it definitely should be the official answer to this question, so I'm posting it again.


Run eval $(minikube docker-env) before building your image.

Full answer here: https://stackoverflow.com/a/40150867


This should work irrespective of whether you are using minikube or not :

1) Start a local registry container:

docker run -d -p 5000:5000 --restart=always --name registry registry:2

2) Do docker images to find out the REPOSITORY and TAG of your local image. Then create a new tag for your local image :

docker tag <local-image-repository>:<local-image-tag> localhost:5000/<local-image-name>

If TAG for your local image is <none>, you can simply do:

docker tag <local-image-repository> localhost:5000/<local-image-name>

3) Push to local registry :

docker push localhost:5000/<local-image-name>

This will automatically add the latest tag to localhost:5000/<local-image-name>.You can check again by doing docker images.

4) In your yaml file, set imagePullPolicy to IfNotPresent :

...spec:  containers:  - name: <name>    image: localhost:5000/<local-image-name>    imagePullPolicy: IfNotPresent...

That's it. Now your ImagePullError should be resolved.