github.com/xeptore/docker-cli@v20.10.14+incompatible/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  # pull
     8  
     9  ```markdown
    10  Usage:  docker pull [OPTIONS] NAME[:TAG|@DIGEST]
    11  
    12  Pull an image or a repository from a registry
    13  
    14  Options:
    15    -a, --all-tags                Download all tagged images in the repository
    16        --disable-content-trust   Skip image verification (default true)
    17        --help                    Print usage
    18    -q, --quiet                   Suppress verbose output
    19  ```
    20  
    21  ## Description
    22  
    23  Most of your images will be created on top of a base image from the
    24  [Docker Hub](https://hub.docker.com) registry.
    25  
    26  [Docker Hub](https://hub.docker.com) contains many pre-built images that you
    27  can `pull` and try without needing to define and configure your own.
    28  
    29  To download a particular image, or set of images (i.e., a repository),
    30  use `docker pull`.
    31  
    32  ### Proxy configuration
    33  
    34  If you are behind an HTTP proxy server, for example in corporate settings,
    35  before open a connect to registry, you may need to configure the Docker
    36  daemon's proxy settings, using the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
    37  environment variables. To set these environment variables on a host using
    38  `systemd`, refer to the [control and configure Docker with systemd](https://docs.docker.com/config/daemon/systemd/#httphttps-proxy)
    39  for variables configuration.
    40  
    41  ### Concurrent downloads
    42  
    43  By default the Docker daemon will pull three layers of an image at a time.
    44  If you are on a low bandwidth connection this may cause timeout issues and you may want to lower
    45  this via the `--max-concurrent-downloads` daemon option. See the
    46  [daemon documentation](dockerd.md) for more details.
    47  
    48  ## Examples
    49  
    50  ### Pull an image from Docker Hub
    51  
    52  To download a particular image, or set of images (i.e., a repository), use
    53  `docker pull`. If no tag is provided, Docker Engine uses the `:latest` tag as a
    54  default. This command pulls the `debian:latest` image:
    55  
    56  ```console
    57  $ docker pull debian
    58  
    59  Using default tag: latest
    60  latest: Pulling from library/debian
    61  fdd5d7827f33: Pull complete
    62  a3ed95caeb02: Pull complete
    63  Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
    64  Status: Downloaded newer image for debian:latest
    65  ```
    66  
    67  Docker images can consist of multiple layers. In the example above, the image
    68  consists of two layers; `fdd5d7827f33` and `a3ed95caeb02`.
    69  
    70  Layers can be reused by images. For example, the `debian:jessie` image shares
    71  both layers with `debian:latest`. Pulling the `debian:jessie` image therefore
    72  only pulls its metadata, but not its layers, because all layers are already
    73  present locally:
    74  
    75  ```console
    76  $ docker pull debian:jessie
    77  
    78  jessie: Pulling from library/debian
    79  fdd5d7827f33: Already exists
    80  a3ed95caeb02: Already exists
    81  Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e
    82  Status: Downloaded newer image for debian:jessie
    83  ```
    84  
    85  To see which images are present locally, use the [`docker images`](images.md)
    86  command:
    87  
    88  ```console
    89  $ docker images
    90  
    91  REPOSITORY   TAG      IMAGE ID        CREATED      SIZE
    92  debian       jessie   f50f9524513f    5 days ago   125.1 MB
    93  debian       latest   f50f9524513f    5 days ago   125.1 MB
    94  ```
    95  
    96  Docker uses a content-addressable image store, and the image ID is a SHA256
    97  digest covering the image's configuration and layers. In the example above,
    98  `debian:jessie` and `debian:latest` have the same image ID because they are
    99  actually the *same* image tagged with different names. Because they are the
   100  same image, their layers are stored only once and do not consume extra disk
   101  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:20.04` pulls the latest version of the Ubuntu
   113  20.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:20.04` image from Docker Hub:
   123  
   124  ```console
   125  $ docker pull ubuntu:20.04
   126  
   127  20.04: Pulling from library/ubuntu
   128  16ec32c2132b: Pull complete
   129  Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
   130  Status: Downloaded newer image for ubuntu:20.04
   131  docker.io/library/ubuntu:20.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:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
   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:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
   149  
   150  docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3: Pulling from library/ubuntu
   151  Digest: sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
   152  Status: Image is up to date for ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
   153  docker.io/library/ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
   154  ```
   155  
   156  Digest can also be used in the `FROM` of a Dockerfile, for example:
   157  
   158  ```dockerfile
   159  FROM ubuntu@sha256:82becede498899ec668628e7cb0ad87b6e1c371cb8a1e597d83a47fac21d6af3
   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 will 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 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  ### Pull a repository with multiple images
   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 `fedora` repository:
   199  
   200  ```console
   201  $ docker pull --all-tags fedora
   202  
   203  Pulling repository fedora
   204  ad57ef8d78d7: Download complete
   205  105182bb5e8b: Download complete
   206  511136ea3c5a: Download complete
   207  73bd853d2ea5: Download complete
   208  ....
   209  
   210  Status: Downloaded newer image for fedora
   211  ```
   212  
   213  After the pull has completed use the `docker images` command to see the
   214  images that were pulled. The example below shows all the `fedora` images
   215  that are present locally:
   216  
   217  ```console
   218  $ docker images fedora
   219  
   220  REPOSITORY   TAG         IMAGE ID        CREATED      SIZE
   221  fedora       rawhide     ad57ef8d78d7    5 days ago   359.3 MB
   222  fedora       20          105182bb5e8b    5 days ago   372.7 MB
   223  fedora       heisenbug   105182bb5e8b    5 days ago   372.7 MB
   224  fedora       latest      105182bb5e8b    5 days ago   372.7 MB
   225  ```
   226  
   227  ### Cancel a pull
   228  
   229  Killing the `docker pull` process, for example by pressing `CTRL-c` while it is
   230  running in a terminal, will terminate the pull operation.
   231  
   232  ```console
   233  $ docker pull fedora
   234  
   235  Using default tag: latest
   236  latest: Pulling from library/fedora
   237  a3ed95caeb02: Pulling fs layer
   238  236608c7b546: Pulling fs layer
   239  ^C
   240  ```
   241  
   242  > **Note**
   243  >
   244  > The Engine terminates a pull operation when the connection between the Docker
   245  > Engine daemon and the Docker Engine client initiating the pull is lost. If the
   246  > connection with the Engine daemon is lost for other reasons than a manual
   247  > interaction, the pull is also aborted.