Parent command

Extended description

Most of your images will be created on top of a base image from the
Docker Hub registry.

Docker Hub contains many pre-built images that you
can pull and try without needing to define and configure your own.

To download a particular image, or set of images (i.e., a repository),
use docker pull.

Proxy configuration

If you are behind an HTTP proxy server, for example in corporate settings,
before open a connect to registry, you may need to configure the Docker
daemon’s proxy settings, using the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
environment variables. To set these environment variables on a host using
systemd, refer to the control and configure Docker with systemd
for variables configuration.

Concurrent downloads

By default the Docker daemon will pull three layers of an image at a time.
If you are on a low bandwidth connection this may cause timeout issues and you may want to lower
this via the --max-concurrent-downloads daemon option. See the
daemon documentation for more details.

Examples

Pull an image from Docker Hub

To download a particular image, or set of images (i.e., a repository), use
docker pull. If no tag is provided, Docker Engine uses the :latest tag as a
default. This command pulls the debian:latest image:

Docker images can consist of multiple layers. In the example above, the image
consists of two layers; fdd5d7827f33 and a3ed95caeb02.

Layers can be reused by images. For example, the debian:jessie image shares
both layers with debian:latest. Pulling the debian:jessie image therefore
only pulls its metadata, but not its layers, because all layers are already
present locally:

Docker uses a content-addressable image store, and the image ID is a SHA256
digest covering the image’s configuration and layers. In the example above,
debian:jessie and debian:latest have the same image ID because they are
actually the same image tagged with different names. Because they are the
same image, their layers are stored only once and do not consume extra disk
space.

Pull an image by digest (immutable identifier)

So far, you’ve pulled images by their name (and “tag”). Using names and tags is
a convenient way to work with images. When using tags, you can docker pull an
image again to make sure you have the most up-to-date version of that image.
For example, docker pull ubuntu:14.04 pulls the latest version of the Ubuntu
14.04 image.

In some cases you don’t want images to be updated to newer versions, but prefer
to use a fixed version of an image. Docker enables you to pull an image by its
digest. When pulling an image by digest, you specify exactly which version
of an image to pull. Doing so, allows you to “pin” an image to that version,
and guarantee that the image you’re using is always the same.

To know the digest of an image, pull the image first. Let’s pull the latest
ubuntu:14.04 image from Docker Hub:

FROM ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
MAINTAINER some maintainer <maintainer@example.com>

Note: Using this feature “pins” an image to a specific version in time.
Docker will therefore not pull updated versions of an image, which may include
security updates. If you want to pull an updated image, you need to change the
digest accordingly.

Pull from a different registry

By default, docker pull pulls images from Docker Hub. It is also possible to
manually specify the path of a registry to pull from. For example, if you have
set up a local registry, you can specify its path to pull from it. A registry
path is similar to a URL, but does not contain a protocol specifier (https://).

The following command pulls the testing/test-image image from a local registry
listening on port 5000 (myregistry.local:5000):

Docker uses the https:// protocol to communicate with a registry, unless the
registry is allowed to be accessed over an insecure connection. Refer to the
insecure registries section for more information.

Pull a repository with multiple images

By default, docker pull pulls a single image from the registry. A repository
can contain multiple images. To pull all images from a repository, provide the
-a (or --all-tags) option when using docker pull.

Note: Technically, the Engine terminates a pull operation when the
connection between the Docker Engine daemon and the Docker Engine client
initiating the pull is lost. If the connection with the Engine daemon is
lost for other reasons than a manual interaction, the pull is also aborted.