<p>First off, I'm completely new with Kubernetes and I'm having a hard time with the documentation.  I'm trying to figure the behavior of the image option in the run command for kubectl.</p>

<pre><code>kubectl run --image=image
</code></pre>

<p><a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run</a></p>

<p>Second, as you can see, the documentation is very clear, but not helpful.</p>

<pre><code>-----------------------------------------------
| Flag   |  Usage                             |
-----------------------------------------------
| image  | The image for the container to run |
-----------------------------------------------
</code></pre>

<p>I can't tell what is the expected behavior here.  Can someone tell answer some this for me?</p>

<ol>
<li>Is this going to try find the image locally first?</li>
<li>Or will it try to find it locally, and if it doesn't find it, it tries to pull it?</li>
<li>Or does it default to pulling the image?</li>
<li>And if it is going try to pull it where is pulling from?  </li>
<li>Does it matter if there are multiple registries listed? </li>
<li>Also how does this work with images on ECR?</li>
</ol>

<p>I hope someone can answer this or at least point me to some good documentation or tutorial.</p>

<p>Thanks.</p>

luis.madrigal
<ol>
<li>This is the docker image, whether it pulls it locally or fetches it from the repo will depend on the <a href="https://kubernetes.io/docs/concepts/containers/images/#updating-images" rel="nofollow noreferrer">imagePullPolicy</a> which defaults to <code>ifNotPresent</code>. The image may be something simple like <code>nginx:latest</code> or it might be from your private registry such as <code>myregistry.domain.com/my-ubuntu</code> or <code>gcr.io/my-project/fancy-new-image</code></li>
</ol>

<p>2 &amp; 3. As mentioned above, depends on the policy</p>

<ol start="4">
<li><p>Where it is pulling from depends on the image. In many cases, you are specifying a registry and then the image such as <code>my.registry.com/my-image</code>. Many common images such as <code>nginx</code> or <code>busybox</code> will probably come from docker.io, however, you can also <a href="https://stackoverflow.com/questions/33054369/how-to-change-the-default-docker-registry-from-docker-io-to-my-private-registry">change the default registry that docker is using</a></p></li>
<li><p>Yes, your container runtime (usually docker) will need to know which registry to pull from, it will not poll different registry at once.</p></li>
<li><p>ECR can be private or public. You will define the ECR registry followed by the image name. ECR will use the following to create the registry name: </p></li>
</ol>

<blockquote>
  <p>The URL for your default registry is <a href="https://aws_account_id.dkr.ecr.region.amazonaws.com" rel="nofollow noreferrer">https://aws_account_id.dkr.ecr.region.amazonaws.com</a>.</p>
</blockquote>

<p>See the <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html" rel="nofollow noreferrer">AWS documentation</a> for more information on how to use and access images from ECR</p>
