github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/cli/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 image pull` (or the `docker pull` shorthand). If no tag is provided,
    54  Docker Engine uses the `:latest` tag as a default. This example pulls the
    55  `debian:latest` image:
    56  
    57  ```console
    58  $ docker image pull debian
    59  
    60  Using default tag: latest
    61  latest: Pulling from library/debian
    62  e756f3fdd6a3: Pull complete
    63  Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
    64  Status: Downloaded newer image for debian:latest
    65  docker.io/library/debian:latest
    66  ```
    67  
    68  Docker images can consist of multiple layers. In the example above, the image
    69  consists of a single layer; `e756f3fdd6a3`.
    70  
    71  Layers can be reused by images. For example, the `debian:bullseye` image shares
    72  its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore
    73  only pulls its metadata, but not its layers, because the layer is already present
    74  locally:
    75  
    76  ```console
    77  $ docker image pull debian:bullseye
    78  
    79  bullseye: Pulling from library/debian
    80  Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
    81  Status: Downloaded newer image for debian:bullseye
    82  docker.io/library/debian:bullseye
    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       bullseye   4eacea30377a   8 days ago     124MB
    93  debian       latest     4eacea30377a   8 days ago     124MB
    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:bullseye` and `debian:latest` have the same image ID because they are
    99  the *same* image tagged with different names. Because they are the same image,
   100  their layers are stored only once and do not consume extra disk space.
   101  
   102  For more information about images, layers, and the content-addressable store,
   103  refer to [understand images, containers, and storage drivers](https://docs.docker.com/storage/storagedriver/).
   104  
   105  
   106  ### Pull an image by digest (immutable identifier)
   107  
   108  So far, you've pulled images by their name (and "tag"). Using names and tags is
   109  a convenient way to work with images. When using tags, you can `docker pull` an
   110  image again to make sure you have the most up-to-date version of that image.
   111  For example, `docker pull ubuntu:22.04` pulls the latest version of the Ubuntu
   112  22.04 image.
   113  
   114  In some cases you don't want images to be updated to newer versions, but prefer
   115  to use a fixed version of an image. Docker enables you to pull an image by its
   116  *digest*. When pulling an image by digest, you specify *exactly* which version
   117  of an image to pull. Doing so, allows you to "pin" an image to that version,
   118  and guarantee that the image you're using is always the same.
   119  
   120  To know the digest of an image, pull the image first. Let's pull the latest
   121  `ubuntu:22.04` image from Docker Hub:
   122  
   123  ```console
   124  $ docker pull ubuntu:22.04
   125  
   126  22.04: Pulling from library/ubuntu
   127  125a6e411906: Pull complete
   128  Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   129  Status: Downloaded newer image for ubuntu:22.04
   130  docker.io/library/ubuntu:22.04
   131  ```
   132  
   133  Docker prints the digest of the image after the pull has finished. In the example
   134  above, the digest of the image is:
   135  
   136  ```console
   137  sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   138  ```
   139  
   140  Docker also prints the digest of an image when *pushing* to a registry. This
   141  may be useful if you want to pin to a version of the image you just pushed.
   142  
   143  A digest takes the place of the tag when pulling an image, for example, to
   144  pull the above image by digest, run the following command:
   145  
   146  ```console
   147  $ docker pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   148  
   149  docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu
   150  Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   151  Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   152  docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   153  ```
   154  
   155  Digest can also be used in the `FROM` of a Dockerfile, for example:
   156  
   157  ```dockerfile
   158  FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   159  LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
   160  ```
   161  
   162  > **Note**
   163  >
   164  > Using this feature "pins" an image to a specific version in time.
   165  > Docker does therefore not pull updated versions of an image, which may include
   166  > security updates. If you want to pull an updated image, you need to change the
   167  > digest accordingly.
   168  
   169  
   170  ### Pull from a different registry
   171  
   172  By default, `docker pull` pulls images from [Docker Hub](https://hub.docker.com). It is also possible to
   173  manually specify the path of a registry to pull from. For example, if you have
   174  set up a local registry, you can specify its path to pull from it. A registry
   175  path is similar to a URL, but does not contain a protocol specifier (`https://`).
   176  
   177  The following command pulls the `testing/test-image` image from a local registry
   178  listening on port 5000 (`myregistry.local:5000`):
   179  
   180  ```console
   181  $ docker image pull myregistry.local:5000/testing/test-image
   182  ```
   183  
   184  Registry credentials are managed by [docker login](login.md).
   185  
   186  Docker uses the `https://` protocol to communicate with a registry, unless the
   187  registry is allowed to be accessed over an insecure connection. Refer to the
   188  [insecure registries](dockerd.md#insecure-registries) section for more information.
   189  
   190  
   191  ### <a name="all-tags"></a> Pull a repository with multiple images (-a, --all-tags)
   192  
   193  By default, `docker pull` pulls a *single* image from the registry. A repository
   194  can contain multiple images. To pull all images from a repository, provide the
   195  `-a` (or `--all-tags`) option when using `docker pull`.
   196  
   197  This command pulls all images from the `ubuntu` repository:
   198  
   199  ```console
   200  $ docker image pull --all-tags ubuntu
   201  
   202  Pulling repository ubuntu
   203  ad57ef8d78d7: Download complete
   204  105182bb5e8b: Download complete
   205  511136ea3c5a: Download complete
   206  73bd853d2ea5: Download complete
   207  ....
   208  
   209  Status: Downloaded newer image for ubuntu
   210  ```
   211  
   212  After the pull has completed use the `docker image ls` command (or the `docker images`
   213  shorthand) to see the images that were pulled. The example below shows all the
   214  `ubuntu` images that are present locally:
   215  
   216  ```console
   217  $ docker image ls --filter reference=ubuntu
   218  REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
   219  ubuntu       18.04     c6ad7e71ba7d   5 weeks ago    63.2MB
   220  ubuntu       bionic    c6ad7e71ba7d   5 weeks ago    63.2MB
   221  ubuntu       22.04     5ccefbfc0416   2 months ago   78MB
   222  ubuntu       focal     ff0fea8310f3   2 months ago   72.8MB
   223  ubuntu       latest    ff0fea8310f3   2 months ago   72.8MB
   224  ubuntu       jammy     41ba606c8ab9   3 months ago   79MB
   225  ubuntu       20.04     ba6acccedd29   7 months ago   72.8MB
   226  ```
   227  
   228  ### Cancel a pull
   229  
   230  Killing the `docker pull` process, for example by pressing `CTRL-c` while it is
   231  running in a terminal, will terminate the pull operation.
   232  
   233  ```console
   234  $ docker pull ubuntu
   235  
   236  Using default tag: latest
   237  latest: Pulling from library/ubuntu
   238  a3ed95caeb02: Pulling fs layer
   239  236608c7b546: Pulling fs layer
   240  ^C
   241  ```
   242  
   243  The Engine terminates a pull operation when the connection between the daemon
   244  and the client (initiating the pull) is cut or lost for any reason or the
   245  command is manually terminated.