<p>I am trying to run a docker image that I have build locally with Kubernetes.</p>

<p>Here is my command line: </p>

<pre><code>kubectl run myImage --image=myImage --port 3030 --image-pull-policy=IfNotPresent
</code></pre>

<p>I have seen many peoples saying that we need to add the <code>--image-pull-policy=IfNotPresent</code> flag so Kubernetes can look for the image locally instead of Docker Hub, but I still get this error (from the Minikube dashboard on the pod, the service and the deployment).</p>

<blockquote>
  <p>Failed to pull image "myImage": rpc error: code = Unknown desc = Error response from daemon: pull access denied for myImage, repository does not exist or may require 'docker login'</p>
</blockquote>

<p>But it looks like there is another issue here, I also tried <code>--image-pull-policy=Never</code> and it doesn't work either.</p>

<p>Any idea?</p>

<p>The <code>image</code> is not available in <code>minikube</code>.</p>

<p>Minikube uses separate <code>docker daemon</code>. That's why, even though the image exists in your machine, it is still missing inside minikube.</p>

<p>First, send the image to minikube by,</p>

<pre><code>docker save myImage | (eval $(minikube docker-env) &amp;&amp; docker load)
</code></pre>

<p>This command will save the image as tar archive, then loads the image in minikube by itself.</p>

<p>Next, use the image in your deployment with <code>image-pull-policy</code> set to <code>IfNotPresent</code></p>

<pre><code>kubectl run myImage --image=myImage --port 3030 --image-pull-policy=IfNotPresent
</code></pre>
