github.com/kobeld/docker@v1.12.0-rc1/docs/reference/commandline/pull.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "pull"
     4  description = "The pull command description and usage"
     5  keywords = ["pull, image, hub, docker"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # pull
    12  
    13      Usage: docker pull [OPTIONS] NAME[:TAG] | [REGISTRY_HOST[:REGISTRY_PORT]/]NAME[:TAG]
    14  
    15      Pull an image or a repository from the registry
    16  
    17        -a, --all-tags                Download all tagged images in the repository
    18        --disable-content-trust=true  Skip image verification
    19        --help                        Print usage
    20  
    21  Most of your images will be created on top of a base image from the
    22  [Docker Hub](https://hub.docker.com) registry.
    23  
    24  [Docker Hub](https://hub.docker.com) contains many pre-built images that you
    25  can `pull` and try without needing to define and configure your own.
    26  
    27  To download a particular image, or set of images (i.e., a repository),
    28  use `docker pull`.
    29  
    30  ## Proxy configuration
    31  
    32  If you are behind an HTTP proxy server, for example in corporate settings,
    33  before open a connect to registry, you may need to configure the Docker
    34  daemon's proxy settings, using the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
    35  environment variables. To set these environment variables on a host using
    36  `systemd`, refer to the [control and configure Docker with systemd](../../admin/systemd.md#http-proxy)
    37  for variables configuration.
    38  
    39  ## Examples
    40  
    41  ### Pull an image from Docker Hub
    42  
    43  To download a particular image, or set of images (i.e., a repository), use
    44  `docker pull`. If no tag is provided, Docker Engine uses the `:latest` tag as a
    45  default. This command pulls the `debian:latest` image:
    46  
    47  ```bash
    48  $ docker pull debian
    49  
    50  Using default tag: latest
    51  latest: Pulling from library/debian
    52  fdd5d7827f33: Pull complete
    53  a3ed95caeb02: Pull complete
    54  Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
    55  Status: Downloaded newer image for debian:latest
    56  ```
    57  
    58  Docker images can consist of multiple layers. In the example above, the image
    59  consists of two layers; `fdd5d7827f33` and `a3ed95caeb02`.
    60  
    61  Layers can be reused by images. For example, the `debian:jessie` image shares
    62  both layers with `debian:latest`. Pulling the `debian:jessie` image therefore
    63  only pulls its metadata, but not its layers, because all layers are already
    64  present locally:
    65  
    66  ```bash
    67  $ docker pull debian:jessie
    68  
    69  jessie: Pulling from library/debian
    70  fdd5d7827f33: Already exists
    71  a3ed95caeb02: Already exists
    72  Digest: sha256:a9c958be96d7d40df920e7041608f2f017af81800ca5ad23e327bc402626b58e
    73  Status: Downloaded newer image for debian:jessie
    74  ```
    75  
    76  To see which images are present locally, use the [`docker images`](images.md)
    77  command:
    78  
    79  ```bash
    80  $ docker images
    81  
    82  REPOSITORY   TAG      IMAGE ID        CREATED      SIZE
    83  debian       jessie   f50f9524513f    5 days ago   125.1 MB
    84  debian       latest   f50f9524513f    5 days ago   125.1 MB
    85  ```
    86  
    87  Docker uses a content-addressable image store, and the image ID is a SHA256
    88  digest covering the image's configuration and layers. In the example above,
    89  `debian:jessie` and `debian:latest` have the same image ID because they are
    90  actually the *same* image tagged with different names. Because they are the
    91  same image, their layers are stored only once and do not consume extra disk
    92  space.
    93  
    94  For more information about images, layers, and the content-addressable store,
    95  refer to [understand images, containers, and storage drivers](../../userguide/storagedriver/imagesandcontainers.md).
    96  
    97  
    98  ## Pull an image by digest (immutable identifier)
    99  
   100  So far, you've pulled images by their name (and "tag"). Using names and tags is
   101  a convenient way to work with images. When using tags, you can `docker pull` an
   102  image again to make sure you have the most up-to-date version of that image.
   103  For example, `docker pull ubuntu:14.04` pulls the latest version of the Ubuntu
   104  14.04 image.
   105  
   106  In some cases you don't want images to be updated to newer versions, but prefer
   107  to use a fixed version of an image. Docker enables you to pull an image by its
   108  *digest*. When pulling an image by digest, you specify *exactly* which version
   109  of an image to pull. Doing so, allows you to "pin" an image to that version,
   110  and guarantee that the image you're using is always the same.
   111  
   112  To know the digest of an image, pull the image first. Let's pull the latest
   113  `ubuntu:14.04` image from Docker Hub:
   114  
   115  ```bash
   116  $ docker pull ubuntu:14.04
   117  
   118  14.04: Pulling from library/ubuntu
   119  5a132a7e7af1: Pull complete
   120  fd2731e4c50c: Pull complete
   121  28a2f68d1120: Pull complete
   122  a3ed95caeb02: Pull complete
   123  Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
   124  Status: Downloaded newer image for ubuntu:14.04
   125  ```
   126  
   127  Docker prints the digest of the image after the pull has finished. In the example
   128  above, the digest of the image is:
   129  
   130      sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
   131  
   132  Docker also prints the digest of an image when *pushing* to a registry. This
   133  may be useful if you want to pin to a version of the image you just pushed.
   134  
   135  A digest takes the place of the tag when pulling an image, for example, to 
   136  pull the above image by digest, run the following command:
   137  
   138  ```bash
   139  $ docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
   140  
   141  sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2: Pulling from library/ubuntu
   142  5a132a7e7af1: Already exists
   143  fd2731e4c50c: Already exists
   144  28a2f68d1120: Already exists
   145  a3ed95caeb02: Already exists
   146  Digest: sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
   147  Status: Downloaded newer image for ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
   148  ```
   149  
   150  Digest can also be used in the `FROM` of a Dockerfile, for example:
   151  
   152  ```Dockerfile
   153  FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
   154  MAINTAINER some maintainer <maintainer@example.com>
   155  ```
   156  
   157  > **Note**: Using this feature "pins" an image to a specific version in time.
   158  > Docker will therefore not pull updated versions of an image, which may include 
   159  > security updates. If you want to pull an updated image, you need to change the
   160  > digest accordingly.
   161  
   162  
   163  ## Pulling from a different registry
   164  
   165  By default, `docker pull` pulls images from [Docker Hub](https://hub.docker.com). It is also possible to
   166  manually specify the path of a registry to pull from. For example, if you have
   167  set up a local registry, you can specify its path to pull from it. A registry
   168  path is similar to a URL, but does not contain a protocol specifier (`https://`).
   169  
   170  The following command pulls the `testing/test-image` image from a local registry
   171  listening on port 5000 (`myregistry.local:5000`):
   172  
   173  ```bash
   174  $ docker pull myregistry.local:5000/testing/test-image
   175  ```
   176  
   177  Registry credentials are managed by [docker login](login.md).
   178  
   179  Docker uses the `https://` protocol to communicate with a registry, unless the
   180  registry is allowed to be accessed over an insecure connection. Refer to the
   181  [insecure registries](dockerd.md#insecure-registries) section for more information.
   182  
   183  
   184  ## Pull a repository with multiple images
   185  
   186  By default, `docker pull` pulls a *single* image from the registry. A repository
   187  can contain multiple images. To pull all images from a repository, provide the
   188  `-a` (or `--all-tags`) option when using `docker pull`.
   189  
   190  This command pulls all images from the `fedora` repository:
   191  
   192  ```bash
   193  $ docker pull --all-tags fedora
   194  
   195  Pulling repository fedora
   196  ad57ef8d78d7: Download complete
   197  105182bb5e8b: Download complete
   198  511136ea3c5a: Download complete
   199  73bd853d2ea5: Download complete
   200  ....
   201  
   202  Status: Downloaded newer image for fedora
   203  ```
   204  
   205  After the pull has completed use the `docker images` command to see the
   206  images that were pulled. The example below shows all the `fedora` images
   207  that are present locally:
   208  
   209  ```bash
   210  $ docker images fedora
   211  
   212  REPOSITORY   TAG         IMAGE ID        CREATED      SIZE
   213  fedora       rawhide     ad57ef8d78d7    5 days ago   359.3 MB
   214  fedora       20          105182bb5e8b    5 days ago   372.7 MB
   215  fedora       heisenbug   105182bb5e8b    5 days ago   372.7 MB
   216  fedora       latest      105182bb5e8b    5 days ago   372.7 MB
   217  ```
   218  
   219  ## Canceling a pull
   220  
   221  Killing the `docker pull` process, for example by pressing `CTRL-c` while it is
   222  running in a terminal, will terminate the pull operation.
   223  
   224  ```bash
   225  $ docker pull fedora
   226  
   227  Using default tag: latest
   228  latest: Pulling from library/fedora
   229  a3ed95caeb02: Pulling fs layer
   230  236608c7b546: Pulling fs layer
   231  ^C
   232  ```
   233  
   234  > **Note**: Technically, the Engine terminates a pull operation when the
   235  > connection between the Docker Engine daemon and the Docker Engine client
   236  > initiating the pull is lost. If the connection with the Engine daemon is
   237  > lost for other reasons than a manual interaction, the pull is also aborted.