1DOCKER(1) JUNE 2014 DOCKER(1)
2
3
4
6 docker-pull - Pull an image or a repository from a registry
7
8
9
11 docker pull [-a|--all-tags] [--help] NAME[:TAG] |
12 [REGISTRY_HOST[:REGISTRY_PORT]/]NAME[:TAG]
13
14
15
17 This command pulls down an image or a repository from a registry. If
18 there is more than one image for a repository (e.g., fedora) then all
19 images for that repository name can be pulled down including any tags
20 (see the option -a or --all-tags).
21
22
23 If you do not specify a REGISTRY_HOST, the command uses Docker's public
24 registry located at registry-1.docker.io by default.
25
26
27
29 -a, --all-tags=true|false
30 Download all tagged images in the repository. The default is false.
31
32
33 --help
34 Print usage statement
35
36
37
39 Pull an image from Docker Hub
40 To download a particular image, or set of images (i.e., a repository),
41 use docker pull. If no tag is provided, Docker Engine uses the :latest
42 tag as a default. This command pulls the debian:latest image:
43
44
45 $ docker pull debian
46
47 Using default tag: latest
48 latest: Pulling from library/debian
49 fdd5d7827f33: Pull complete
50 a3ed95caeb02: Pull complete
51 Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
52 Status: Downloaded newer image for debian:latest
53
54
55
56 Docker images can consist of multiple layers. In the example above, the
57 image consists of two layers; fdd5d7827f33 and a3ed95caeb02.
58
59
60 Layers can be reused by images. For example, the debian:jessie image
61 shares both layers with debian:latest. Pulling the debian:jessie image
62 therefore only pulls its metadata, but not its layers, because all
63 layers are already present locally:
64
65
66 $ docker pull debian:jessie
67
68 jessie: Pulling from library/debian
69 fdd5d7827f33: Already exists
70 a3ed95caeb02: Already exists
71 Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e
72 Status: Downloaded newer image for debian:jessie
73
74
75
76 To see which images are present locally, use the docker-images(1)
77 command:
78
79
80 $ docker images
81
82 REPOSITORY TAG IMAGE ID CREATED SIZE
83 debian jessie f50f9524513f 5 days ago 125.1 MB
84 debian latest f50f9524513f 5 days ago 125.1 MB
85
86
87
88 Docker uses a content-addressable image store, and the image ID is a
89 SHA256 digest covering the image's configuration and layers. In the
90 example above, debian:jessie and debian:latest have the same image ID
91 because they are actually the same image tagged with different names.
92 Because they are the same image, their layers are stored only once and
93 do not consume extra disk space.
94
95
96 For more information about images, layers, and the content-addressable
97 store, refer to understand images, containers, and storage drivers
98 ⟨https://docs.docker.com/engine/userguide/storagedriver/imagesandcontainers/⟩
99 in the online documentation.
100
101
103 So far, you've pulled images by their name (and "tag"). Using names and
104 tags is a convenient way to work with images. When using tags, you can
105 docker pull an image again to make sure you have the most up-to-date
106 version of that image. For example, docker pull ubuntu:14.04 pulls the
107 latest version of the Ubuntu 14.04 image.
108
109
110 In some cases you don't want images to be updated to newer versions,
111 but prefer to use a fixed version of an image. Docker enables you to
112 pull an image by its digest. When pulling an image by digest, you
113 specify exactly which version of an image to pull. Doing so, allows you
114 to "pin" an image to that version, and guarantee that the image you're
115 using is always the same.
116
117
118 To know the digest of an image, pull the image first. Let's pull the
119 latest ubuntu:14.04 image from Docker Hub:
120
121
122 $ docker pull ubuntu:14.04
123
124 14.04: Pulling from library/ubuntu
125 5a132a7e7af1: Pull complete
126 fd2731e4c50c: Pull complete
127 28a2f68d1120: Pull complete
128 a3ed95caeb02: Pull complete
129 Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
130 Status: Downloaded newer image for ubuntu:14.04
131
132
133
134 Docker prints the digest of the image after the pull has finished. In
135 the example above, the digest of the image is:
136
137
138 sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
139
140
141
142 Docker also prints the digest of an image when pushing to a registry.
143 This may be useful if you want to pin to a version of the image you
144 just pushed.
145
146
147 A digest takes the place of the tag when pulling an image, for example,
148 to pull the above image by digest, run the following command:
149
150
151 $ docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
152
153 sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling from library/ubuntu
154 5a132a7e7af1: Already exists
155 fd2731e4c50c: Already exists
156 28a2f68d1120: Already exists
157 a3ed95caeb02: Already exists
158 Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
159 Status: Downloaded newer image for ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
160
161
162
163 Digest can also be used in the FROM of a Dockerfile, for example:
164
165
166 FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
167 MAINTAINER some maintainer <maintainer@example.com>
168
169
170
171 Note: Using this feature "pins" an image to a specific version
172 in time. Docker will therefore not pull updated versions of an
173 image, which may include security updates. If you want to pull
174 an updated image, you need to change the digest accordingly.
175
176
178 By default, docker pull pulls images from Docker Hub. It is also
179 possible to manually specify the path of a registry to pull from. For
180 example, if you have set up a local registry, you can specify its path
181 to pull from it. A registry path is similar to a URL, but does not
182 contain a protocol specifier (https://).
183
184
185 The following command pulls the testing/test-image image from a local
186 registry listening on port 5000 (myregistry.local:5000):
187
188
189 $ docker pull myregistry.local:5000/testing/test-image
190
191
192
193 Registry credentials are managed by docker-login(1).
194
195
196 Docker uses the https:// protocol to communicate with a registry,
197 unless the registry is allowed to be accessed over an insecure
198 connection. Refer to the insecure registries
199 ⟨https://docs.docker.com/engine/reference/commandline/daemon/#insecure-
200 registries⟩ section in the online documentation for more information.
201
202
204 By default, docker pull pulls a single image from the registry. A
205 repository can contain multiple images. To pull all images from a
206 repository, provide the -a (or --all-tags) option when using docker
207 pull.
208
209
210 This command pulls all images from the fedora repository:
211
212
213 $ docker pull --all-tags fedora
214
215 Pulling repository fedora
216 ad57ef8d78d7: Download complete
217 105182bb5e8b: Download complete
218 511136ea3c5a: Download complete
219 73bd853d2ea5: Download complete
220
221 Status: Downloaded newer image for fedora
222
223
224
225 After the pull has completed use the docker images command to see the
226 images that were pulled. The example below shows all the fedora images
227 that are present locally:
228
229
230 $ docker images fedora
231
232 REPOSITORY TAG IMAGE ID CREATED SIZE
233 fedora rawhide ad57ef8d78d7 5 days ago 359.3 MB
234 fedora 20 105182bb5e8b 5 days ago 372.7 MB
235 fedora heisenbug 105182bb5e8b 5 days ago 372.7 MB
236 fedora latest 105182bb5e8b 5 days ago 372.7 MB
237
238
239
241 Killing the docker pull process, for example by pressing CTRL-c while
242 it is running in a terminal, will terminate the pull operation.
243
244
245 $ docker pull fedora
246
247 Using default tag: latest
248 latest: Pulling from library/fedora
249 a3ed95caeb02: Pulling fs layer
250 236608c7b546: Pulling fs layer
251 ^C
252
253
254
255 Note: Technically, the Engine terminates a pull operation when
256 the connection between the Docker Engine daemon and the Docker
257 Engine client initiating the pull is lost. If the connection
258 with the Engine daemon is lost for other reasons than a manual
259 interaction, the pull is also aborted.
260
261
262
264 April 2014, Originally compiled by William Henry (whenry at redhat dot
265 com) based on docker.com source material and internal work. June 2014,
266 updated by Sven Dowideit ⟨SvenDowideit@home.org.au⟩ August 2014,
267 updated by Sven Dowideit ⟨SvenDowideit@home.org.au⟩ April 2015, updated
268 by John Willis ⟨john.willis@docker.com⟩ April 2015, updated by Mary
269 Anthony for v2 ⟨mary@docker.com⟩ September 2015, updated by Sally
270 O'Malley ⟨somalley@redhat.com⟩
271
272
273
274Docker Community Docker User Manuals DOCKER(1)