github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/image_pull.md (about)

     1  # pull
     2  
     3  <!---MARKER_GEN_START-->
     4  Download an image from a registry
     5  
     6  ### Aliases
     7  
     8  `docker image pull`, `docker pull`
     9  
    10  ### Options
    11  
    12  | Name                                         | Type     | Default | Description                                      |
    13  |:---------------------------------------------|:---------|:--------|:-------------------------------------------------|
    14  | [`-a`](#all-tags), [`--all-tags`](#all-tags) |          |         | Download all tagged images in the repository     |
    15  | `--disable-content-trust`                    | `bool`   | `true`  | Skip image verification                          |
    16  | `--platform`                                 | `string` |         | Set platform if server is multi-platform capable |
    17  | `-q`, `--quiet`                              |          |         | Suppress verbose output                          |
    18  
    19  
    20  <!---MARKER_GEN_END-->
    21  
    22  ## Description
    23  
    24  Most of your images will be created on top of a base image from the
    25  [Docker Hub](https://hub.docker.com) registry.
    26  
    27  [Docker Hub](https://hub.docker.com) contains many pre-built images that you
    28  can `pull` and try without needing to define and configure your own.
    29  
    30  To download a particular image, or set of images (i.e., a repository),
    31  use `docker pull`.
    32  
    33  ### Proxy configuration
    34  
    35  If you are behind an HTTP proxy server, for example in corporate settings,
    36  before open a connect to registry, you may need to configure the Docker
    37  daemon's proxy settings, refer to the [dockerd command-line reference](https://docs.docker.com/reference/cli/dockerd/#proxy-configuration)
    38  for details.
    39  
    40  ### Concurrent downloads
    41  
    42  By default the Docker daemon will pull three layers of an image at a time.
    43  If you are on a low bandwidth connection this may cause timeout issues and you may want to lower
    44  this via the `--max-concurrent-downloads` daemon option. See the
    45  [daemon documentation](https://docs.docker.com/reference/cli/dockerd/) for more details.
    46  
    47  ## Examples
    48  
    49  ### Pull an image from Docker Hub
    50  
    51  To download a particular image, or set of images (i.e., a repository), use
    52  `docker image pull` (or the `docker pull` shorthand). If no tag is provided,
    53  Docker Engine uses the `:latest` tag as a default. This example pulls the
    54  `debian:latest` image:
    55  
    56  ```console
    57  $ docker image pull debian
    58  
    59  Using default tag: latest
    60  latest: Pulling from library/debian
    61  e756f3fdd6a3: Pull complete
    62  Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
    63  Status: Downloaded newer image for debian:latest
    64  docker.io/library/debian:latest
    65  ```
    66  
    67  Docker images can consist of multiple layers. In the example above, the image
    68  consists of a single layer; `e756f3fdd6a3`.
    69  
    70  Layers can be reused by images. For example, the `debian:bookworm` image shares
    71  its layer with the `debian:latest`. Pulling the `debian:bookworm` image therefore
    72  only pulls its metadata, but not its layers, because the layer is already present
    73  locally:
    74  
    75  ```console
    76  $ docker image pull debian:bookworm
    77  
    78  bookworm: Pulling from library/debian
    79  Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
    80  Status: Downloaded newer image for debian:bookworm
    81  docker.io/library/debian:bookworm
    82  ```
    83  
    84  To see which images are present locally, use the [`docker images`](image_ls.md)
    85  command:
    86  
    87  ```console
    88  $ docker images
    89  
    90  REPOSITORY   TAG        IMAGE ID       CREATED        SIZE
    91  debian       bookworm   4eacea30377a   8 days ago     124MB
    92  debian       latest     4eacea30377a   8 days ago     124MB
    93  ```
    94  
    95  Docker uses a content-addressable image store, and the image ID is a SHA256
    96  digest covering the image's configuration and layers. In the example above,
    97  `debian:bookworm` and `debian:latest` have the same image ID because they are
    98  the same image tagged with different names. Because they are the same image,
    99  their layers are stored only once and do not consume extra disk space.
   100  
   101  For more information about images, layers, and the content-addressable store,
   102  refer to [understand images, containers, and storage drivers](https://docs.docker.com/storage/storagedriver/).
   103  
   104  
   105  ### Pull an image by digest (immutable identifier)
   106  
   107  So far, you've pulled images by their name (and "tag"). Using names and tags is
   108  a convenient way to work with images. When using tags, you can `docker pull` an
   109  image again to make sure you have the most up-to-date version of that image.
   110  For example, `docker pull ubuntu:22.04` pulls the latest version of the Ubuntu
   111  22.04 image.
   112  
   113  In some cases you don't want images to be updated to newer versions, but prefer
   114  to use a fixed version of an image. Docker enables you to pull an image by its
   115  digest. When pulling an image by digest, you specify exactly which version
   116  of an image to pull. Doing so, allows you to "pin" an image to that version,
   117  and guarantee that the image you're using is always the same.
   118  
   119  To know the digest of an image, pull the image first. Let's pull the latest
   120  `ubuntu:22.04` image from Docker Hub:
   121  
   122  ```console
   123  $ docker pull ubuntu:22.04
   124  
   125  22.04: Pulling from library/ubuntu
   126  125a6e411906: Pull complete
   127  Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   128  Status: Downloaded newer image for ubuntu:22.04
   129  docker.io/library/ubuntu:22.04
   130  ```
   131  
   132  Docker prints the digest of the image after the pull has finished. In the example
   133  above, the digest of the image is:
   134  
   135  ```console
   136  sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   137  ```
   138  
   139  Docker also prints the digest of an image when pushing to a registry. This
   140  may be useful if you want to pin to a version of the image you just pushed.
   141  
   142  A digest takes the place of the tag when pulling an image, for example, to
   143  pull the above image by digest, run the following command:
   144  
   145  ```console
   146  $ docker pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   147  
   148  docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu
   149  Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   150  Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   151  docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   152  ```
   153  
   154  Digest can also be used in the `FROM` of a Dockerfile, for example:
   155  
   156  ```dockerfile
   157  FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   158  LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
   159  ```
   160  
   161  > **Note**
   162  >
   163  > Using this feature "pins" an image to a specific version in time.
   164  > Docker does therefore not pull updated versions of an image, which may include
   165  > security updates. If you want to pull an updated image, you need to change the
   166  > digest accordingly.
   167  
   168  
   169  ### Pull from a different registry
   170  
   171  By default, `docker pull` pulls images from [Docker Hub](https://hub.docker.com). It is also possible to
   172  manually specify the path of a registry to pull from. For example, if you have
   173  set up a local registry, you can specify its path to pull from it. A registry
   174  path is similar to a URL, but does not contain a protocol specifier (`https://`).
   175  
   176  The following command pulls the `testing/test-image` image from a local registry
   177  listening on port 5000 (`myregistry.local:5000`):
   178  
   179  ```console
   180  $ docker image pull myregistry.local:5000/testing/test-image
   181  ```
   182  
   183  Registry credentials are managed by [docker login](login.md).
   184  
   185  Docker uses the `https://` protocol to communicate with a registry, unless the
   186  registry is allowed to be accessed over an insecure connection. Refer to the
   187  [insecure registries](https://docs.docker.com/reference/cli/dockerd/#insecure-registries) section for more information.
   188  
   189  
   190  ### <a name="all-tags"></a> Pull a repository with multiple images (-a, --all-tags)
   191  
   192  By default, `docker pull` pulls a single image from the registry. A repository
   193  can contain multiple images. To pull all images from a repository, provide the
   194  `-a` (or `--all-tags`) option when using `docker pull`.
   195  
   196  This command pulls all images from the `ubuntu` repository:
   197  
   198  ```console
   199  $ docker image pull --all-tags ubuntu
   200  
   201  Pulling repository ubuntu
   202  ad57ef8d78d7: Download complete
   203  105182bb5e8b: Download complete
   204  511136ea3c5a: Download complete
   205  73bd853d2ea5: Download complete
   206  ....
   207  
   208  Status: Downloaded newer image for ubuntu
   209  ```
   210  
   211  After the pull has completed use the `docker image ls` command (or the `docker images`
   212  shorthand) to see the images that were pulled. The example below shows all the
   213  `ubuntu` images that are present locally:
   214  
   215  ```console
   216  $ docker image ls --filter reference=ubuntu
   217  REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
   218  ubuntu       18.04     c6ad7e71ba7d   5 weeks ago    63.2MB
   219  ubuntu       bionic    c6ad7e71ba7d   5 weeks ago    63.2MB
   220  ubuntu       22.04     5ccefbfc0416   2 months ago   78MB
   221  ubuntu       focal     ff0fea8310f3   2 months ago   72.8MB
   222  ubuntu       latest    ff0fea8310f3   2 months ago   72.8MB
   223  ubuntu       jammy     41ba606c8ab9   3 months ago   79MB
   224  ubuntu       20.04     ba6acccedd29   7 months ago   72.8MB
   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 ubuntu
   234  
   235  Using default tag: latest
   236  latest: Pulling from library/ubuntu
   237  a3ed95caeb02: Pulling fs layer
   238  236608c7b546: Pulling fs layer
   239  ^C
   240  ```
   241  
   242  The Engine terminates a pull operation when the connection between the daemon
   243  and the client (initiating the pull) is cut or lost for any reason or the
   244  command is manually terminated.