<p>I am trying to deploy Windows Container image on the following software stack</p>
<pre><code>Windows 10 Pro + Docker Desktop + Embedded Kubernetes in docker desktop
</code></pre>
<p>Due to some reason <code>'embedded kubernetes'</code> does not recognize <code>'local images'</code> no matter whatever <code>--image-pull-policy</code> was set</p>
<p>Docker images</p>
<pre><code>PS C:\WINDOWS\system32&gt; docker images
REPOSITORY                             TAG        IMAGE ID       CREATED        SIZE
myimg                                  final      90c09acbfc59   15 hours ago   5.45GB
</code></pre>
<p>Kubectl run</p>
<pre><code>PS C:\WINDOWS\system32&gt; kubectl run --image=myimg:final tskuberun
</code></pre>
<p>Pod output</p>
<pre><code>Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  25s                default-scheduler  Successfully assigned default/tskuberun to docker-desktop
  Normal   BackOff    23s (x2 over 24s)  kubelet            Back-off pulling image &quot;myimg:final&quot;
  Warning  Failed     23s (x2 over 24s)  kubelet            Error: ImagePullBackOff
  Normal   Pulling    9s (x2 over 25s)   kubelet            Pulling image &quot;myimg:final&quot;
  Warning  Failed     8s (x2 over 25s)   kubelet            Failed to pull image &quot;myimg:final&quot;: rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.5:53: no such host
  Warning  Failed     8s (x2 over 25s)   kubelet            Error: ErrImagePull
</code></pre>
<p>However, when I execute docker run it pulled the local image.  Following worked as expected</p>
<pre><code>PS C:\WINDOWS\system32&gt; docker run myimg:final
</code></pre>
<p>I googled for the answer but most of the links were related to Unix flavors and Minikube.</p>
<p>Only few links were related to <code>Docker desktop + embedded kubernetes</code>, but unfortunately none resolved the issue</p>
<p>I am struggling to get rid of this issue.  Any help is highly appreciated</p>
<p><strong>EDIT</strong></p>
<p>On further investigation, I observed that <code>'Docker desktop'</code> refers to local images in case had I selected option <code>&quot;Switch to Linux Containers&quot;</code></p>
<p>Kubectl run for Linux image</p>
<pre><code>PS C:\WINDOWS\system32&gt; kubectl run --image=wphp --image-pull-policy=IfNotPresent lntest


PS C:\WINDOWS\system32&gt; kubectl describe pod/lntest

Events:
  Type     Reason     Age               From               Message
  ----     ------     ----              ----               -------
  Normal   Scheduled  40s               default-scheduler  Successfully assigned default/lntest to docker-desktop
  Normal   Pulled     2s (x4 over 39s)  kubelet            Container image &quot;wphp&quot; already present on machine
  Normal   Created    2s (x4 over 39s)  kubelet            Created container lntest
  Normal   Started    2s (x4 over 39s)  kubelet            Started container lntest
</code></pre>
<p>It appears that this issue occurs only for 'Windows containers' ie Docker desktop does NOT refer local images had I selected option <code>'Switch to Windows Containers'</code></p>

<p>Allthough <code>imagePullPolicy: never</code> should do the trick for you, there could be some certificate related issues.</p>
<p>Personally I avoided using locally built Docker images because of those issues.</p>
<p>You can try to integrate docker push to docker hub in your workflow or build a docker registry in your kubernetes cluster e.g. using <a href="https://www.linuxtechi.com/setup-private-docker-registry-kubernetes/" rel="nofollow noreferrer">https://www.linuxtechi.com/setup-private-docker-registry-kubernetes/</a></p>
