github.com/brahmaroutu/docker@v1.2.1-0.20160809185609-eb28dde01f16/docs/reference/commandline/pull.md (about) 1 <!--[metadata]> 2 +++ 3 title = "pull" 4 description = "The pull command description and usage" 5 keywords = ["pull, image, hub, docker"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # pull 12 13 ```markdown 14 Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST] 15 16 Pull an image or a repository from a registry 17 18 Options: 19 -a, --all-tags Download all tagged images in the repository 20 --disable-content-trust Skip image verification (default true) 21 --help Print usage 22 ``` 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](../../admin/systemd.md#http-proxy) 40 for variables configuration. 41 42 ## Examples 43 44 ### Pull an image from Docker Hub 45 46 To download a particular image, or set of images (i.e., a repository), use 47 `docker pull`. If no tag is provided, Docker Engine uses the `:latest` tag as a 48 default. This command pulls the `debian:latest` image: 49 50 ```bash 51 $ docker pull debian 52 53 Using default tag: latest 54 latest: Pulling from library/debian 55 fdd5d7827f33: Pull complete 56 a3ed95caeb02: Pull complete 57 Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa 58 Status: Downloaded newer image for debian:latest 59 ``` 60 61 Docker images can consist of multiple layers. In the example above, the image 62 consists of two layers; `fdd5d7827f33` and `a3ed95caeb02`. 63 64 Layers can be reused by images. For example, the `debian:jessie` image shares 65 both layers with `debian:latest`. Pulling the `debian:jessie` image therefore 66 only pulls its metadata, but not its layers, because all layers are already 67 present locally: 68 69 ```bash 70 $ docker pull debian:jessie 71 72 jessie: Pulling from library/debian 73 fdd5d7827f33: Already exists 74 a3ed95caeb02: Already exists 75 Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e 76 Status: Downloaded newer image for debian:jessie 77 ``` 78 79 To see which images are present locally, use the [`docker images`](images.md) 80 command: 81 82 ```bash 83 $ docker images 84 85 REPOSITORY TAG IMAGE ID CREATED SIZE 86 debian jessie f50f9524513f 5 days ago 125.1 MB 87 debian latest f50f9524513f 5 days ago 125.1 MB 88 ``` 89 90 Docker uses a content-addressable image store, and the image ID is a SHA256 91 digest covering the image's configuration and layers. In the example above, 92 `debian:jessie` and `debian:latest` have the same image ID because they are 93 actually the *same* image tagged with different names. Because they are the 94 same image, their layers are stored only once and do not consume extra disk 95 space. 96 97 For more information about images, layers, and the content-addressable store, 98 refer to [understand images, containers, and storage drivers](../../userguide/storagedriver/imagesandcontainers.md). 99 100 101 ## Pull an image by digest (immutable identifier) 102 103 So far, you've pulled images by their name (and "tag"). Using names and tags is 104 a convenient way to work with images. When using tags, you can `docker pull` an 105 image again to make sure you have the most up-to-date version of that image. 106 For example, `docker pull ubuntu:14.04` pulls the latest version of the Ubuntu 107 14.04 image. 108 109 In some cases you don't want images to be updated to newer versions, but prefer 110 to use a fixed version of an image. Docker enables you to pull an image by its 111 *digest*. When pulling an image by digest, you specify *exactly* which version 112 of an image to pull. Doing so, allows you to "pin" an image to that version, 113 and guarantee that the image you're using is always the same. 114 115 To know the digest of an image, pull the image first. Let's pull the latest 116 `ubuntu:14.04` image from Docker Hub: 117 118 ```bash 119 $ docker pull ubuntu:14.04 120 121 14.04: Pulling from library/ubuntu 122 5a132a7e7af1: Pull complete 123 fd2731e4c50c: Pull complete 124 28a2f68d1120: Pull complete 125 a3ed95caeb02: Pull complete 126 Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 127 Status: Downloaded newer image for ubuntu:14.04 128 ``` 129 130 Docker prints the digest of the image after the pull has finished. In the example 131 above, the digest of the image is: 132 133 sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 134 135 Docker also prints the digest of an image when *pushing* to a registry. This 136 may be useful if you want to pin to a version of the image you just pushed. 137 138 A digest takes the place of the tag when pulling an image, for example, to 139 pull the above image by digest, run the following command: 140 141 ```bash 142 $ docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 143 144 sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling from library/ubuntu 145 5a132a7e7af1: Already exists 146 fd2731e4c50c: Already exists 147 28a2f68d1120: Already exists 148 a3ed95caeb02: Already exists 149 Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 150 Status: Downloaded newer image for ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 151 ``` 152 153 Digest can also be used in the `FROM` of a Dockerfile, for example: 154 155 ```Dockerfile 156 FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2 157 MAINTAINER some maintainer <maintainer@example.com> 158 ``` 159 160 > **Note**: Using this feature "pins" an image to a specific version in time. 161 > Docker will therefore not pull updated versions of an image, which may include 162 > security updates. If you want to pull an updated image, you need to change the 163 > digest accordingly. 164 165 166 ## Pulling from a different registry 167 168 By default, `docker pull` pulls images from [Docker Hub](https://hub.docker.com). It is also possible to 169 manually specify the path of a registry to pull from. For example, if you have 170 set up a local registry, you can specify its path to pull from it. A registry 171 path is similar to a URL, but does not contain a protocol specifier (`https://`). 172 173 The following command pulls the `testing/test-image` image from a local registry 174 listening on port 5000 (`myregistry.local:5000`): 175 176 ```bash 177 $ docker pull myregistry.local:5000/testing/test-image 178 ``` 179 180 Registry credentials are managed by [docker login](login.md). 181 182 Docker uses the `https://` protocol to communicate with a registry, unless the 183 registry is allowed to be accessed over an insecure connection. Refer to the 184 [insecure registries](dockerd.md#insecure-registries) section for more information. 185 186 187 ## Pull a repository with multiple images 188 189 By default, `docker pull` pulls a *single* image from the registry. A repository 190 can contain multiple images. To pull all images from a repository, provide the 191 `-a` (or `--all-tags`) option when using `docker pull`. 192 193 This command pulls all images from the `fedora` repository: 194 195 ```bash 196 $ docker pull --all-tags fedora 197 198 Pulling repository fedora 199 ad57ef8d78d7: Download complete 200 105182bb5e8b: Download complete 201 511136ea3c5a: Download complete 202 73bd853d2ea5: Download complete 203 .... 204 205 Status: Downloaded newer image for fedora 206 ``` 207 208 After the pull has completed use the `docker images` command to see the 209 images that were pulled. The example below shows all the `fedora` images 210 that are present locally: 211 212 ```bash 213 $ docker images fedora 214 215 REPOSITORY TAG IMAGE ID CREATED SIZE 216 fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB 217 fedora 20 105182bb5e8b 5 days ago 372.7 MB 218 fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB 219 fedora latest 105182bb5e8b 5 days ago 372.7 MB 220 ``` 221 222 ## Canceling a pull 223 224 Killing the `docker pull` process, for example by pressing `CTRL-c` while it is 225 running in a terminal, will terminate the pull operation. 226 227 ```bash 228 $ docker pull fedora 229 230 Using default tag: latest 231 latest: Pulling from library/fedora 232 a3ed95caeb02: Pulling fs layer 233 236608c7b546: Pulling fs layer 234 ^C 235 ``` 236 237 > **Note**: Technically, the Engine terminates a pull operation when the 238 > connection between the Docker Engine daemon and the Docker Engine client 239 > initiating the pull is lost. If the connection with the Engine daemon is 240 > lost for other reasons than a manual interaction, the pull is also aborted.