Docker Community Forums

Share and learn in the Docker community.

Cant access local images with Docker for Windows in Kubernetes (Linux mode)


(Trondhindenes) #1

I’m trying to understand the dev flow with Docker for Windows and Kubernetes.
I created a simple “dummy” image based on nginx called mytest:latest

Then I tried referencing this in a pod:
kubectl run -it mytest --image mytest:latest

This leads to an ImagePullError on the kubernetes pod.

At this point I’m a bit unsure how this is supposed to work, but given that the Kubernetes runs in the same moby instance as “regular” docker, and my local docker client is using the moby vm’s docker engine I can’t see why this shouldn’t work? The rest of the kubernetes install looks fine, and I can pull public images.


(Marcele1987) #2

I had the same issue. The problem is the tag “latest”, it just doesn’t work with “latest” and a local image on Docker for Windows.
Just change it to something else when you build your image and use that version on kubectl.

mytest:v1
kubectl run -it mytest --image mytest:v1

That should work.


(Trondhindenes) #3

Thanks!
I also found out that by setting the container’s imagePullPolicy to IfNotPresent it also works.