.nh .TH "DOCKER" "1" "Jan 2024" "Docker Community" "Docker User Manuals" .SH NAME .PP docker-image-pull - Pull an image or a repository from a registry .SH SYNOPSIS .PP \fBdocker image pull [OPTIONS] NAME[:TAG|@DIGEST]\fP .SH DESCRIPTION .PP This command pulls down an image or a repository from a registry. If there is more than one image for a repository (e.g., fedora) then all images for that repository name can be pulled down including any tags (see the option \fB-a\fP or \fB--all-tags\fP). .PP If you do not specify a \fBREGISTRY_HOST\fR, the command uses Docker's public registry located at \fBregistry-1.docker.io\fR by default. .SH EXAMPLES .SS Pull an image from Docker Hub .PP To download a particular image, or set of images (i.e., a repository), use \fBdocker image pull\fR (or the \fBdocker pull\fR shorthand). If no tag is provided, Docker Engine uses the \fB:latest\fR tag as a default. This example pulls the \fBdebian:latest\fR image: .EX $ docker image pull debian Using default tag: latest latest: Pulling from library/debian e756f3fdd6a3: Pull complete Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 Status: Downloaded newer image for debian:latest docker.io/library/debian:latest .EE .PP Docker images can consist of multiple layers. In the example above, the image consists of a single layer; \fBe756f3fdd6a3\fR\&. .PP Layers can be reused by images. For example, the \fBdebian:bullseye\fR image shares its layer with the \fBdebian:latest\fR\&. Pulling the \fBdebian:bullseye\fR image therefore only pulls its metadata, but not its layers, because the layer is already present locally: .EX $ docker image pull debian:bullseye bullseye: Pulling from library/debian Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 Status: Downloaded newer image for debian:bullseye docker.io/library/debian:bullseye .EE .PP To see which images are present locally, use the \fBdocker-images(1)\fP command: .EX $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE debian bullseye 4eacea30377a 8 days ago 124MB debian latest 4eacea30377a 8 days ago 124MB .EE .PP 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, \fBdebian:bullseye\fR and \fBdebian:latest\fR have the same image ID because they are the \fIsame\fP image tagged with different names. Because they are the same image, their layers are stored only once and do not consume extra disk space. .PP For more information about images, layers, and the content-addressable store, refer to understand images, containers, and storage drivers \[la]https://docs.docker.com/storage/storagedriver/\[ra] in the online documentation. .SH Pull an image by digest (immutable identifier) .PP 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 \fBdocker image pull\fR an image again to make sure you have the most up-to-date version of that image. For example, \fBdocker image pull ubuntu:22.04\fR pulls the latest version of the Ubuntu 22.04 image. .PP 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 \fIdigest\fP\&. When pulling an image by digest, you specify \fIexactly\fP 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. .PP To know the digest of an image, pull the image first. Let's pull the latest \fBubuntu:22.04\fR image from Docker Hub: .EX $ docker image pull ubuntu:22.04 22.04: Pulling from library/ubuntu 125a6e411906: Pull complete Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d Status: Downloaded newer image for ubuntu:22.04 docker.io/library/ubuntu:22.04 .EE .PP Docker prints the digest of the image after the pull has finished. In the example above, the digest of the image is: .EX sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d .EE .PP Docker also prints the digest of an image when \fIpushing\fP to a registry. This may be useful if you want to pin to a version of the image you just pushed. .PP 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: .EX $ docker image pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d .EE .PP Digest can also be used in the \fBFROM\fR of a Dockerfile, for example: .EX FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d LABEL org.opencontainers.image.authors="some maintainer " .EE .PP .RS .PP \fBNote\fP .PP Using this feature "pins" an image to a specific version in time. Docker does 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. .RE .SH Pull from a different registry .PP By default, \fBdocker image pull\fR pulls images from Docker Hub. 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 (\fBhttps://\fR). .PP The following command pulls the \fBtesting/test-image\fR image from a local registry listening on port 5000 (\fBmyregistry.local:5000\fR): .EX $ docker image pull myregistry.local:5000/testing/test-image .EE .PP Registry credentials are managed by \fBdocker-login(1)\fP\&. .PP Docker uses the \fBhttps://\fR protocol to communicate with a registry, unless the registry is allowed to be accessed over an insecure connection. Refer to the insecure registries \[la]https://docs.docker.com/engine/reference/commandline/dockerd/#insecure\-registries\[ra] section in the online documentation for more information. .SH Pull a repository with multiple images .PP By default, \fBdocker image pull\fR pulls a \fIsingle\fP image from the registry. A repository can contain multiple images. To pull all images from a repository, provide the \fB-a\fR (or \fB--all-tags\fR) option when using \fBdocker image pull\fR\&. .PP This command pulls all images from the \fBubuntu\fR repository: .EX $ docker image pull --all-tags ubuntu Pulling repository ubuntu ad57ef8d78d7: Download complete 105182bb5e8b: Download complete 511136ea3c5a: Download complete 73bd853d2ea5: Download complete .... Status: Downloaded newer image for ubuntu .EE .PP After the pull has completed use the \fBdocker image ls\fR (or \fBdocker images\fR shorthand) command to see the images that were pulled. The example below shows all the \fBubuntu\fR images that are present locally: .EX $ docker image ls --filter reference=ubuntu REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu 18.04 c6ad7e71ba7d 5 weeks ago 63.2MB ubuntu bionic c6ad7e71ba7d 5 weeks ago 63.2MB ubuntu 22.04 5ccefbfc0416 2 months ago 78MB ubuntu focal ff0fea8310f3 2 months ago 72.8MB ubuntu latest ff0fea8310f3 2 months ago 72.8MB ubuntu jammy 41ba606c8ab9 3 months ago 79MB ubuntu 20.04 ba6acccedd29 7 months ago 72.8MB ... .EE .SH Cancel a pull .PP Killing the \fBdocker image pull\fR process, for example by pressing \fBCTRL-c\fR while it is running in a terminal, will terminate the pull operation. .EX $ docker image pull ubuntu Using default tag: latest latest: Pulling from library/ubuntu a3ed95caeb02: Pulling fs layer 236608c7b546: Pulling fs layer ^C .EE .PP 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. .SH OPTIONS .PP \fB-a\fP, \fB--all-tags\fP[=false] Download all tagged images in the repository .PP \fB--disable-content-trust\fP[=true] Skip image verification .PP \fB-h\fP, \fB--help\fP[=false] help for pull .PP \fB--platform\fP="" Set platform if server is multi-platform capable .PP \fB-q\fP, \fB--quiet\fP[=false] Suppress verbose output .SH SEE ALSO .PP \fBdocker-image(1)\fP