github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/docs/reference/commandline/pull.md (about) 1 # pull 2 3 <!---MARKER_GEN_START--> 4 Download an image from a registry 5 6 ### Aliases 7 8 `docker image pull`, `docker pull` 9 10 ### Options 11 12 | Name | Type | Default | Description | 13 |:---------------------------------------------|:---------|:--------|:-------------------------------------------------| 14 | [`-a`](#all-tags), [`--all-tags`](#all-tags) | | | Download all tagged images in the repository | 15 | `--disable-content-trust` | | | Skip image verification | 16 | `--platform` | `string` | | Set platform if server is multi-platform capable | 17 | `-q`, `--quiet` | | | Suppress verbose output | 18 19 20 <!---MARKER_GEN_END--> 21 22 ## Description 23 24 Most of your images will be created on top of a base image from the 25 [Docker Hub](https://hub.docker.com) registry. 26 27 [Docker Hub](https://hub.docker.com) contains many pre-built images that you 28 can `pull` and try without needing to define and configure your own. 29 30 To download a particular image, or set of images (i.e., a repository), 31 use `docker pull`. 32 33 ### Proxy configuration 34 35 If you are behind an HTTP proxy server, for example in corporate settings, 36 before open a connect to registry, you may need to configure the Docker 37 daemon's proxy settings, using the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` 38 environment variables. To set these environment variables on a host using 39 `systemd`, refer to the [control and configure Docker with systemd](https://docs.docker.com/config/daemon/systemd/#httphttps-proxy) 40 for variables configuration. 41 42 ### Concurrent downloads 43 44 By default the Docker daemon will pull three layers of an image at a time. 45 If you are on a low bandwidth connection this may cause timeout issues and you may want to lower 46 this via the `--max-concurrent-downloads` daemon option. See the 47 [daemon documentation](dockerd.md) for more details. 48 49 ## Examples 50 51 ### Pull an image from Docker Hub 52 53 To download a particular image, or set of images (i.e., a repository), use 54 `docker image pull` (or the `docker pull` shorthand). If no tag is provided, 55 Docker Engine uses the `:latest` tag as a default. This example pulls the 56 `debian:latest` image: 57 58 ```console 59 $ docker image pull debian 60 61 Using default tag: latest 62 latest: Pulling from library/debian 63 e756f3fdd6a3: Pull complete 64 Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 65 Status: Downloaded newer image for debian:latest 66 docker.io/library/debian:latest 67 ``` 68 69 Docker images can consist of multiple layers. In the example above, the image 70 consists of a single layer; `e756f3fdd6a3`. 71 72 Layers can be reused by images. For example, the `debian:bullseye` image shares 73 its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore 74 only pulls its metadata, but not its layers, because the layer is already present 75 locally: 76 77 ```console 78 $ docker image pull debian:bullseye 79 80 bullseye: Pulling from library/debian 81 Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510 82 Status: Downloaded newer image for debian:bullseye 83 docker.io/library/debian:bullseye 84 ``` 85 86 To see which images are present locally, use the [`docker images`](images.md) 87 command: 88 89 ```console 90 $ docker images 91 92 REPOSITORY TAG IMAGE ID CREATED SIZE 93 debian bullseye 4eacea30377a 8 days ago 124MB 94 debian latest 4eacea30377a 8 days ago 124MB 95 ``` 96 97 Docker uses a content-addressable image store, and the image ID is a SHA256 98 digest covering the image's configuration and layers. In the example above, 99 `debian:bullseye` and `debian:latest` have the same image ID because they are 100 the *same* image tagged with different names. Because they are the same image, 101 their layers are stored only once and do not consume extra disk space. 102 103 For more information about images, layers, and the content-addressable store, 104 refer to [understand images, containers, and storage drivers](https://docs.docker.com/storage/storagedriver/). 105 106 107 ### Pull an image by digest (immutable identifier) 108 109 So far, you've pulled images by their name (and "tag"). Using names and tags is 110 a convenient way to work with images. When using tags, you can `docker pull` an 111 image again to make sure you have the most up-to-date version of that image. 112 For example, `docker pull ubuntu:22.04` pulls the latest version of the Ubuntu 113 22.04 image. 114 115 In some cases you don't want images to be updated to newer versions, but prefer 116 to use a fixed version of an image. Docker enables you to pull an image by its 117 *digest*. When pulling an image by digest, you specify *exactly* which version 118 of an image to pull. Doing so, allows you to "pin" an image to that version, 119 and guarantee that the image you're using is always the same. 120 121 To know the digest of an image, pull the image first. Let's pull the latest 122 `ubuntu:22.04` image from Docker Hub: 123 124 ```console 125 $ docker pull ubuntu:22.04 126 127 22.04: Pulling from library/ubuntu 128 125a6e411906: Pull complete 129 Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 130 Status: Downloaded newer image for ubuntu:22.04 131 docker.io/library/ubuntu:22.04 132 ``` 133 134 Docker prints the digest of the image after the pull has finished. In the example 135 above, the digest of the image is: 136 137 ```console 138 sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 139 ``` 140 141 Docker also prints the digest of an image when *pushing* to a registry. This 142 may be useful if you want to pin to a version of the image you just pushed. 143 144 A digest takes the place of the tag when pulling an image, for example, to 145 pull the above image by digest, run the following command: 146 147 ```console 148 $ docker pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 149 150 docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu 151 Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 152 Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 153 docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 154 ``` 155 156 Digest can also be used in the `FROM` of a Dockerfile, for example: 157 158 ```dockerfile 159 FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d 160 LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>" 161 ``` 162 163 > **Note** 164 > 165 > Using this feature "pins" an image to a specific version in time. 166 > Docker does therefore not pull updated versions of an image, which may include 167 > security updates. If you want to pull an updated image, you need to change the 168 > digest accordingly. 169 170 171 ### Pull from a different registry 172 173 By default, `docker pull` pulls images from [Docker Hub](https://hub.docker.com). It is also possible to 174 manually specify the path of a registry to pull from. For example, if you have 175 set up a local registry, you can specify its path to pull from it. A registry 176 path is similar to a URL, but does not contain a protocol specifier (`https://`). 177 178 The following command pulls the `testing/test-image` image from a local registry 179 listening on port 5000 (`myregistry.local:5000`): 180 181 ```console 182 $ docker image pull myregistry.local:5000/testing/test-image 183 ``` 184 185 Registry credentials are managed by [docker login](login.md). 186 187 Docker uses the `https://` protocol to communicate with a registry, unless the 188 registry is allowed to be accessed over an insecure connection. Refer to the 189 [insecure registries](dockerd.md#insecure-registries) section for more information. 190 191 192 ### <a name="all-tags"></a> Pull a repository with multiple images (-a, --all-tags) 193 194 By default, `docker pull` pulls a *single* image from the registry. A repository 195 can contain multiple images. To pull all images from a repository, provide the 196 `-a` (or `--all-tags`) option when using `docker pull`. 197 198 This command pulls all images from the `ubuntu` repository: 199 200 ```console 201 $ docker image pull --all-tags ubuntu 202 203 Pulling repository ubuntu 204 ad57ef8d78d7: Download complete 205 105182bb5e8b: Download complete 206 511136ea3c5a: Download complete 207 73bd853d2ea5: Download complete 208 .... 209 210 Status: Downloaded newer image for ubuntu 211 ``` 212 213 After the pull has completed use the `docker image ls` command (or the `docker images` 214 shorthand) to see the images that were pulled. The example below shows all the 215 `ubuntu` images that are present locally: 216 217 ```console 218 $ docker image ls --filter reference=ubuntu 219 REPOSITORY TAG IMAGE ID CREATED SIZE 220 ubuntu 18.04 c6ad7e71ba7d 5 weeks ago 63.2MB 221 ubuntu bionic c6ad7e71ba7d 5 weeks ago 63.2MB 222 ubuntu 22.04 5ccefbfc0416 2 months ago 78MB 223 ubuntu focal ff0fea8310f3 2 months ago 72.8MB 224 ubuntu latest ff0fea8310f3 2 months ago 72.8MB 225 ubuntu jammy 41ba606c8ab9 3 months ago 79MB 226 ubuntu 20.04 ba6acccedd29 7 months ago 72.8MB 227 ``` 228 229 ### Cancel a pull 230 231 Killing the `docker pull` process, for example by pressing `CTRL-c` while it is 232 running in a terminal, will terminate the pull operation. 233 234 ```console 235 $ docker pull ubuntu 236 237 Using default tag: latest 238 latest: Pulling from library/ubuntu 239 a3ed95caeb02: Pulling fs layer 240 236608c7b546: Pulling fs layer 241 ^C 242 ``` 243 244 The Engine terminates a pull operation when the connection between the daemon 245 and the client (initiating the pull) is cut or lost for any reason or the 246 command is manually terminated.