Minikube can't pull image from local registry

9/7/2017

I ran eval $(minikube docker-env) then built a docker container. When I run docker images on my host I can see the image. When I run minikube ssh then docker images I can see it.

When I try to run it, the pod fails to launch. kubectl describe pod gives:

14m     3m      7   kubelet, minikube   spec.containers{quoting-crab-customer-refresh-cache-cron}   Normal      Pulling         pulling image "personalisation-customer:latest"
14m     3m      7   kubelet, minikube   spec.containers{quoting-crab-customer-refresh-cache-cron}   Warning     Failed          Failed to pull image "personalisation-customer:latest": rpc error: code = 2 desc = Error: image library/personalisation-customer:latest not found
14m     2s      66  kubelet, minikube                                   Warning     FailedSync      Error syncing pod
14m     2s      59  kubelet, minikube   spec.containers{quoting-crab-customer-refresh-cache-cron}   Normal      BackOff         Back-off pulling image "personalisation-customer:latest"

My imagePullPolicy is Always.

What could be causing this? Other pods are working locally.

-- jbrown
kubernetes
minikube

3 Answers

10/11/2019

I had the same issue. Thing that was happened to me was not mentioning the image version. I used

kubectl run testapp1 --image=<image> --image-pull-policy=IfNotPresent

But image with the version works for me finally.

kubectl run testapp1 --image=<image>:<version> --image-pull-policy=IfNotPresent
-- Sandun Gunasekara
Source: StackOverflow

9/7/2017

You aren't exactly pulling from your local registry, you are using your previously downloaded images or your locally builded, since you are specifying imagePullPolicy: Always this will always try to pull it from the registry.

Your image doesn't contain a specific docker registry personalisation-customer:latest for what docker will understand index.docker.io/personalisation-customer:latest and this is an image that doesn't exist in the public docker registry.

So you have 2 options imagePullPolicy: IfNotPresent or to upload the image to some registry.

-- jhernandez
Source: StackOverflow

9/7/2017

The local Docker cache isn't a registry. Kubernetes tries to download the image from Dockerhub (the default registry), since you set iMagePullPolicy to Always. Set it to Never, so Kubernetes uses to local image.

-- svenwltr
Source: StackOverflow