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