summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fpull%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/docker/engine%2Freference%2Fcommandline%2Fpull%2Findex.html
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fpull%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fpull%2Findex.html72
1 files changed, 72 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fpull%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fpull%2Findex.html
new file mode 100644
index 00000000..72672345
--- /dev/null
+++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fpull%2Findex.html
@@ -0,0 +1,72 @@
+<h1>docker pull</h1> <p><br></p> <p>Pull an image or a repository from a registry</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker pull [OPTIONS] NAME[:TAG|@DIGEST]
+</pre></div> <p>Refer to the <a href="#options">options section</a> for an overview of available <a href="#options"><code class="language-plaintext highlighter-rouge">OPTIONS</code></a> for this command.</p> <h2 id="description">Description</h2> <p name="extended-description">Most of your images will be created on top of a base image from the <a href="https://hub.docker.com">Docker Hub</a> registry.</p> <p><a href="https://hub.docker.com">Docker Hub</a> contains many pre-built images that you can <code class="language-plaintext highlighter-rouge">pull</code> and try without needing to define and configure your own.</p> <p>To download a particular image, or set of images (i.e., a repository), use <code class="language-plaintext highlighter-rouge">docker pull</code>.</p> <h3 id="proxy-configuration">Proxy configuration</h3> <p>If you are behind an HTTP proxy server, for example in corporate settings, before open a connect to registry, you may need to configure the Docker daemon’s proxy settings, using the <code class="language-plaintext highlighter-rouge">HTTP_PROXY</code>, <code class="language-plaintext highlighter-rouge">HTTPS_PROXY</code>, and <code class="language-plaintext highlighter-rouge">NO_PROXY</code> environment variables. To set these environment variables on a host using <code class="language-plaintext highlighter-rouge">systemd</code>, refer to the <a href="https://docs.docker.com/config/daemon/systemd/#httphttps-proxy">control and configure Docker with systemd</a> for variables configuration.</p> <h3 id="concurrent-downloads">Concurrent downloads</h3> <p>By default the Docker daemon will pull three layers of an image at a time. If you are on a low bandwidth connection this may cause timeout issues and you may want to lower this via the <code class="language-plaintext highlighter-rouge">--max-concurrent-downloads</code> daemon option. See the <a href="../dockerd/index">daemon documentation</a> for more details.</p> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p> <h2 id="options">Options</h2> <table> <thead> <tr> <td>Name, shorthand</td> <td>Default</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--all-tags</code> , <code class="language-plaintext highlighter-rouge">-a</code>
+</td> <td></td> <td>Download all tagged images in the repository</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--disable-content-trust</code></td> <td><code class="language-plaintext highlighter-rouge">true</code></td> <td>Skip image verification</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--platform</code></td> <td></td> <td>Set platform if server is multi-platform capable</td> </tr> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--quiet</code> , <code class="language-plaintext highlighter-rouge">-q</code>
+</td> <td></td> <td>Suppress verbose output</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="pull-an-image-from-docker-hub">Pull an image from Docker Hub</h3> <p>To download a particular image, or set of images (i.e., a repository), use <code class="language-plaintext highlighter-rouge">docker pull</code>. If no tag is provided, Docker Engine uses the <code class="language-plaintext highlighter-rouge">:latest</code> tag as a default. This command pulls the <code class="language-plaintext highlighter-rouge">debian:latest</code> image:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker pull debian
+
+Using default tag: latest
+latest: Pulling from library/debian
+fdd5d7827f33: Pull complete
+a3ed95caeb02: Pull complete
+Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
+Status: Downloaded newer image for debian:latest
+</pre></div> <p>Docker images can consist of multiple layers. In the example above, the image consists of two layers; <code class="language-plaintext highlighter-rouge">fdd5d7827f33</code> and <code class="language-plaintext highlighter-rouge">a3ed95caeb02</code>.</p> <p>Layers can be reused by images. For example, the <code class="language-plaintext highlighter-rouge">debian:jessie</code> image shares both layers with <code class="language-plaintext highlighter-rouge">debian:latest</code>. Pulling the <code class="language-plaintext highlighter-rouge">debian:jessie</code> image therefore only pulls its metadata, but not its layers, because all layers are already present locally:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker pull debian:jessie
+
+jessie: Pulling from library/debian
+fdd5d7827f33: Already exists
+a3ed95caeb02: Already exists
+Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e
+Status: Downloaded newer image for debian:jessie
+</pre></div> <p>To see which images are present locally, use the <a href="../images/index"><code class="language-plaintext highlighter-rouge">docker images</code></a> command:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker images
+
+REPOSITORY TAG IMAGE ID CREATED SIZE
+debian jessie f50f9524513f 5 days ago 125.1 MB
+debian latest f50f9524513f 5 days ago 125.1 MB
+</pre></div> <p>Docker uses a content-addressable image store, and the image ID is a SHA256 digest covering the image’s configuration and layers. In the example above, <code class="language-plaintext highlighter-rouge">debian:jessie</code> and <code class="language-plaintext highlighter-rouge">debian:latest</code> have the same image ID because they are actually the <em>same</em> image tagged with different names. Because they are the same image, their layers are stored only once and do not consume extra disk space.</p> <p>For more information about images, layers, and the content-addressable store, refer to <a href="https://docs.docker.com/storage/storagedriver/">understand images, containers, and storage drivers</a>.</p> <h3 id="pull-an-image-by-digest-immutable-identifier">Pull an image by digest (immutable identifier)</h3> <p>So far, you’ve pulled images by their name (and “tag”). Using names and tags is a convenient way to work with images. When using tags, you can <code class="language-plaintext highlighter-rouge">docker pull</code> an image again to make sure you have the most up-to-date version of that image. For example, <code class="language-plaintext highlighter-rouge">docker pull ubuntu:20.04</code> pulls the latest version of the Ubuntu 20.04 image.</p> <p>In some cases you don’t want images to be updated to newer versions, but prefer to use a fixed version of an image. Docker enables you to pull an image by its <em>digest</em>. When pulling an image by digest, you specify <em>exactly</em> which version of an image to pull. Doing so, allows you to “pin” an image to that version, and guarantee that the image you’re using is always the same.</p> <p>To know the digest of an image, pull the image first. Let’s pull the latest <code class="language-plaintext highlighter-rouge">ubuntu:20.04</code> image from Docker Hub:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker pull ubuntu:20.04
+
+20.04: Pulling from library/ubuntu
+16ec32c2132b: Pull complete
+Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
+Status: Downloaded newer image for ubuntu:20.04
+docker.io/library/ubuntu:20.04
+</pre></div> <p>Docker prints the digest of the image after the pull has finished. In the example above, the digest of the image is:</p> <div class="highlight"><pre class="highlight" data-language="">sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
+</pre></div> <p>Docker also prints the digest of an image when <em>pushing</em> to a registry. This may be useful if you want to pin to a version of the image you just pushed.</p> <p>A digest takes the place of the tag when pulling an image, for example, to pull the above image by digest, run the following command:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker pull ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
+
+docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3: Pulling from library/ubuntu
+Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
+Status: Image is up to date for ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
+docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
+</pre></div> <p>Digest can also be used in the <code class="language-plaintext highlighter-rouge">FROM</code> of a Dockerfile, for example:</p> <div class="highlight"><pre class="highlight" data-language="">FROM ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
+LABEL org.opencontainers.image.authors="some maintainer &lt;maintainer@example.com&gt;"
+</pre></div> <blockquote> <p><strong>Note</strong></p> <p>Using this feature “pins” an image to a specific version in time. Docker will therefore not pull updated versions of an image, which may include security updates. If you want to pull an updated image, you need to change the digest accordingly.</p> </blockquote> <h3 id="pull-from-a-different-registry">Pull from a different registry</h3> <p>By default, <code class="language-plaintext highlighter-rouge">docker pull</code> pulls images from <a href="https://hub.docker.com">Docker Hub</a>. It is also possible to manually specify the path of a registry to pull from. For example, if you have set up a local registry, you can specify its path to pull from it. A registry path is similar to a URL, but does not contain a protocol specifier (<code class="language-plaintext highlighter-rouge">https://</code>).</p> <p>The following command pulls the <code class="language-plaintext highlighter-rouge">testing/test-image</code> image from a local registry listening on port 5000 (<code class="language-plaintext highlighter-rouge">myregistry.local:5000</code>):</p> <div class="highlight"><pre class="highlight" data-language="">$ docker pull myregistry.local:5000/testing/test-image
+</pre></div> <p>Registry credentials are managed by <a href="../login/index">docker login</a>.</p> <p>Docker uses the <code class="language-plaintext highlighter-rouge">https://</code> protocol to communicate with a registry, unless the registry is allowed to be accessed over an insecure connection. Refer to the <a href="../dockerd/index#insecure-registries">insecure registries</a> section for more information.</p> <h3 id="pull-a-repository-with-multiple-images">Pull a repository with multiple images</h3> <p>By default, <code class="language-plaintext highlighter-rouge">docker pull</code> pulls a <em>single</em> image from the registry. A repository can contain multiple images. To pull all images from a repository, provide the <code class="language-plaintext highlighter-rouge">-a</code> (or <code class="language-plaintext highlighter-rouge">--all-tags</code>) option when using <code class="language-plaintext highlighter-rouge">docker pull</code>.</p> <p>This command pulls all images from the <code class="language-plaintext highlighter-rouge">fedora</code> repository:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker pull --all-tags fedora
+
+Pulling repository fedora
+ad57ef8d78d7: Download complete
+105182bb5e8b: Download complete
+511136ea3c5a: Download complete
+73bd853d2ea5: Download complete
+....
+
+Status: Downloaded newer image for fedora
+</pre></div> <p>After the pull has completed use the <code class="language-plaintext highlighter-rouge">docker images</code> command to see the images that were pulled. The example below shows all the <code class="language-plaintext highlighter-rouge">fedora</code> images that are present locally:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker images fedora
+
+REPOSITORY TAG IMAGE ID CREATED SIZE
+fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB
+fedora 20 105182bb5e8b 5 days ago 372.7 MB
+fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB
+fedora latest 105182bb5e8b 5 days ago 372.7 MB
+</pre></div> <h3 id="cancel-a-pull">Cancel a pull</h3> <p>Killing the <code class="language-plaintext highlighter-rouge">docker pull</code> process, for example by pressing <code class="language-plaintext highlighter-rouge">CTRL-c</code> while it is running in a terminal, will terminate the pull operation.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker pull fedora
+
+Using default tag: latest
+latest: Pulling from library/fedora
+a3ed95caeb02: Pulling fs layer
+236608c7b546: Pulling fs layer
+^C
+</pre></div> <blockquote> <p><strong>Note</strong></p> <p>The Engine terminates a pull operation when the connection between the Docker Engine daemon and the Docker Engine client initiating the pull is lost. If the connection with the Engine daemon is lost for other reasons than a manual interaction, the pull is also aborted.</p> </blockquote> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br>
+ <a href="https://docs.docker.com/engine/reference/commandline/pull/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/pull/</a>
+ </p>
+</div>