<p>How to refer to the local image that exists? </p>

<pre><code>kubectl run u --rm -i --tty --image my_local_image -- bash
</code></pre>

<p>Results in <code>ImagePullBackOff</code> and <code>kubectl</code> is obviously trying to pull from a remote repository instead of local register.</p>

<p>This <a href="https://stackoverflow.com/questions/43462384/kubectl-run-local-docker-image-imagepullbackoff-status">answer</a> is unhelpful, and the follow up refers to minikube and kubernetes. </p>

<p>Some event logs</p>

<pre><code>Events:
  Type     Reason                 Age               From                         Message
  ----     ------                 ----              ----                         -------
  Normal   Scheduled              1m                default-scheduler            Successfully assigned u-6988b9c446-zcp99 to docker-for-desktop
  Normal   SuccessfulMountVolume  1m                kubelet, docker-for-desktop  MountVolume.SetUp succeeded for volume "default-token-q2qm7"
  Normal   SandboxChanged         1m                kubelet, docker-for-desktop  Pod sandbox changed, it will be killed and re-created.
  Normal   Pulling                23s (x3 over 1m)  kubelet, docker-for-desktop  pulling image "centos_postgres"
  Warning  Failed                 22s (x3 over 1m)  kubelet, docker-for-desktop  Failed to pull image "centos_postgres": rpc error: code = Unknown desc = Error response from daemon: pull access denied for centos_postgres, repository does not exist or may require 'docker login'
  Warning  Failed                 22s (x3 over 1m)  kubelet, docker-for-desktop  Error: ErrImagePull
  Normal   BackOff                9s (x5 over 1m)   kubelet, docker-for-desktop  Back-off pulling image "centos_postgres"
  Warning  Failed                 9s (x5 over 1m)   kubelet, docker-for-desktop  Error: ImagePullBackOff
</code></pre>

<p>Kubernetes Pods have an <code>imagePullPolicy</code> field. If you set that to <code>Never</code>, it will never try to pull an image, and it's up to you to ensure that the docker daemon which the kubelet is using contains that image. The default policy is <code>IfNotPresent</code>, which should work the same as <code>Never</code> if an image is already present in the docker daemon. Double check that your docker daemon actually contains what you think it contains, and make sure your <code>imagePullPolicy</code> is set to one of the two that I mentioned.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
    - name: my-image
      image: local-image-name
      imagePullPolicy: Never
</code></pre>
