github.com/olljanat/moby@v1.13.1/man/docker-pull.1.md (about)

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