github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/cli/man/src/image/pull.md (about)

     1  This command pulls down an image or a repository from a registry. If
     2  there is more than one image for a repository (e.g., fedora) then all
     3  images for that repository name can be pulled down including any tags
     4  (see the option **-a** or **--all-tags**).
     5  
     6  If you do not specify a `REGISTRY_HOST`, the command uses Docker's public
     7  registry located at `registry-1.docker.io` by default. 
     8  
     9  # EXAMPLES
    10  
    11  ### Pull an image from Docker Hub
    12  
    13  To download a particular image, or set of images (i.e., a repository), use
    14  `docker image pull` (or the `docker pull` shorthand). If no tag is provided,
    15  Docker Engine uses the `:latest` tag as a default. This example pulls the
    16  `debian:latest` image:
    17  
    18      $ docker image pull debian
    19  
    20      Using default tag: latest
    21      latest: Pulling from library/debian
    22      e756f3fdd6a3: Pull complete
    23      Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
    24      Status: Downloaded newer image for debian:latest
    25      docker.io/library/debian:latest
    26  
    27  Docker images can consist of multiple layers. In the example above, the image
    28  consists of a single layer; `e756f3fdd6a3`.
    29  
    30  Layers can be reused by images. For example, the `debian:bullseye` image shares
    31  its layer with the `debian:latest`. Pulling the `debian:bullseye` image therefore
    32  only pulls its metadata, but not its layers, because the layer is already present
    33  locally:
    34  
    35      $ docker image pull debian:bullseye
    36  
    37      bullseye: Pulling from library/debian
    38      Digest: sha256:3f1d6c17773a45c97bd8f158d665c9709d7b29ed7917ac934086ad96f92e4510
    39      Status: Downloaded newer image for debian:bullseye
    40      docker.io/library/debian:bullseye
    41  
    42  To see which images are present locally, use the **docker-images(1)**
    43  command:
    44  
    45      $ docker images
    46  
    47      REPOSITORY   TAG        IMAGE ID       CREATED        SIZE
    48      debian       bullseye   4eacea30377a   8 days ago     124MB
    49      debian       latest     4eacea30377a   8 days ago     124MB
    50  
    51  Docker uses a content-addressable image store, and the image ID is a SHA256
    52  digest covering the image's configuration and layers. In the example above,
    53  `debian:bullseye` and `debian:latest` have the same image ID because they are
    54  the *same* image tagged with different names. Because they are the same image,
    55  their layers are stored only once and do not consume extra disk space.
    56  
    57  For more information about images, layers, and the content-addressable store,
    58  refer to [understand images, containers, and storage drivers](https://docs.docker.com/storage/storagedriver/)
    59  in the online documentation.
    60  
    61  
    62  ## Pull an image by digest (immutable identifier)
    63  
    64  So far, you've pulled images by their name (and "tag"). Using names and tags is
    65  a convenient way to work with images. When using tags, you can `docker image pull` an
    66  image again to make sure you have the most up-to-date version of that image.
    67  For example, `docker image pull ubuntu:22.04` pulls the latest version of the Ubuntu
    68  22.04 image.
    69  
    70  In some cases you don't want images to be updated to newer versions, but prefer
    71  to use a fixed version of an image. Docker enables you to pull an image by its
    72  *digest*. When pulling an image by digest, you specify *exactly* which version
    73  of an image to pull. Doing so, allows you to "pin" an image to that version,
    74  and guarantee that the image you're using is always the same.
    75  
    76  To know the digest of an image, pull the image first. Let's pull the latest
    77  `ubuntu:22.04` image from Docker Hub:
    78  
    79      $ docker image pull ubuntu:22.04
    80  
    81      22.04: Pulling from library/ubuntu
    82      125a6e411906: Pull complete
    83      Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
    84      Status: Downloaded newer image for ubuntu:22.04
    85      docker.io/library/ubuntu:22.04
    86  
    87  Docker prints the digest of the image after the pull has finished. In the example
    88  above, the digest of the image is:
    89  
    90      sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
    91  
    92  Docker also prints the digest of an image when *pushing* to a registry. This
    93  may be useful if you want to pin to a version of the image you just pushed.
    94  
    95  A digest takes the place of the tag when pulling an image, for example, to
    96  pull the above image by digest, run the following command:
    97  
    98      $ docker image pull ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
    99  
   100      docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d: Pulling from library/ubuntu
   101      Digest: sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   102      Status: Image is up to date for ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   103      docker.io/library/ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   104  
   105  Digest can also be used in the `FROM` of a Dockerfile, for example:
   106  
   107      FROM ubuntu@sha256:26c68657ccce2cb0a31b330cb0be2b5e108d467f641c62e13ab40cbec258c68d
   108      LABEL org.opencontainers.image.authors="some maintainer <maintainer@example.com>"
   109  
   110  > **Note**
   111  >
   112  > Using this feature "pins" an image to a specific version in time.
   113  > Docker does therefore not pull updated versions of an image, which may include
   114  > security updates. If you want to pull an updated image, you need to change the
   115  > digest accordingly.
   116  
   117  ## Pull from a different registry
   118  
   119  By default, `docker image pull` pulls images from Docker Hub. It is also possible to
   120  manually specify the path of a registry to pull from. For example, if you have
   121  set up a local registry, you can specify its path to pull from it. A registry
   122  path is similar to a URL, but does not contain a protocol specifier (`https://`).
   123  
   124  The following command pulls the `testing/test-image` image from a local registry
   125  listening on port 5000 (`myregistry.local:5000`):
   126  
   127      $ docker image pull myregistry.local:5000/testing/test-image
   128  
   129  Registry credentials are managed by **docker-login(1)**.
   130  
   131  Docker uses the `https://` protocol to communicate with a registry, unless the
   132  registry is allowed to be accessed over an insecure connection. Refer to the
   133  [insecure registries](https://docs.docker.com/engine/reference/commandline/dockerd/#insecure-registries)
   134  section in the online documentation for more information.
   135  
   136  
   137  ## Pull a repository with multiple images
   138  
   139  By default, `docker image pull` pulls a *single* image from the registry. A repository
   140  can contain multiple images. To pull all images from a repository, provide the
   141  `-a` (or `--all-tags`) option when using `docker image pull`.
   142  
   143  This command pulls all images from the `ubuntu` repository:
   144  
   145      $ docker image pull --all-tags ubuntu
   146  
   147      Pulling repository ubuntu
   148      ad57ef8d78d7: Download complete
   149      105182bb5e8b: Download complete
   150      511136ea3c5a: Download complete
   151      73bd853d2ea5: Download complete
   152      ....
   153  
   154      Status: Downloaded newer image for ubuntu
   155  
   156  After the pull has completed use the `docker image ls` (or `docker images` shorthand)
   157  command to see the images that were pulled. The example below shows all the `ubuntu`
   158  images that are present locally:
   159  
   160      $ docker image ls --filter reference=ubuntu
   161      REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
   162      ubuntu       18.04     c6ad7e71ba7d   5 weeks ago    63.2MB
   163      ubuntu       bionic    c6ad7e71ba7d   5 weeks ago    63.2MB
   164      ubuntu       22.04     5ccefbfc0416   2 months ago   78MB
   165      ubuntu       focal     ff0fea8310f3   2 months ago   72.8MB
   166      ubuntu       latest    ff0fea8310f3   2 months ago   72.8MB
   167      ubuntu       jammy     41ba606c8ab9   3 months ago   79MB
   168      ubuntu       20.04     ba6acccedd29   7 months ago   72.8MB
   169      ...
   170  
   171  ## Cancel a pull
   172  
   173  Killing the `docker image pull` process, for example by pressing `CTRL-c` while it is
   174  running in a terminal, will terminate the pull operation.
   175  
   176      $ docker image pull ubuntu
   177  
   178      Using default tag: latest
   179      latest: Pulling from library/ubuntu
   180      a3ed95caeb02: Pulling fs layer
   181      236608c7b546: Pulling fs layer
   182      ^C
   183  
   184  The Engine terminates a pull operation when the connection between the Docker
   185  Engine daemon and the Docker Engine client initiating the pull is lost. If the
   186  connection with the Engine daemon is lost for other reasons than a manual
   187  interaction, the pull is also aborted.