github.com/itscaro/cli@v0.0.0-20190705081621-c9db0fe93829/docs/reference/commandline/pull.md (about)

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