Docker pull command

Docker command reference


docker pullThe command is used to pull (download) images from a Docker registry (such as Docker Hub) to the local machine.

docker pullThe command allows users to obtain the required image to run containers locally.

Syntax

docker pull [OPTIONS] NAME[:TAG|@DIGEST]
  • NAME: Image name, usually includes the registry address (e.g.docker.io/library/ubuntu)。
  • TAG(Optional) : Image tag, defaults tolatest。
  • DIGEST(Optional): SHA256 digest of the image.

Common options:

  • --all-tags, -a: Download all tags of the specified image.
  • --disable-content-trust: Skip image signature verification.

1. Pull the image with the default tag (latest)

docker pull ubuntu

This will pull an image named ubuntu from Docker Hub, with the tag defaulting to latest.

2. Pull an image with a specific tag

docker pull ubuntu:20.04

This will pull an image named ubuntu from Docker Hub, with the tag 20.04.

3. Pull an image with a specific digest

docker pull ubuntu@sha256:12345abcdef...

This pulls the ubuntu image with a specific SHA256 digest.

4. Pull all tags of an image

docker pull --all-tags ubuntu

This pulls all available tags of the ubuntu image.

5. Pull images from a custom registry

docker pull myregistry.com/myrepo/myimage:mytag

This will pull the myimage image from the myrepo repository in the myregistry.com registry, with the tag mytag.

Example

1. Pull the Ubuntu image:

docker pull ubuntu

Output example:

Using default tag: latest
latest: Pulling from library/ubuntu
Digest: sha256:12345abcdef...
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest

2. Pull the Ubuntu image with a specified tag

docker pull ubuntu:20.04

Output example:

20.04: Pulling from library/ubuntu
Digest: sha256:67890abcdef...
Status: Downloaded newer image for ubuntu:20.04
docker.io/library/ubuntu:20.04

Notes

  • Default tag islatestbut it is best to explicitly specify a tag to avoid pulling an unexpected version.
  • Ensure there is enough disk space to store the pulled image.
  • In production environments, it is recommended to use the image digest to ensure the uniqueness and consistency of the image.

docker pullThe command is a basic tool for obtaining Docker images. By specifying the image name, tag, or digest, you can download the required image from a Docker registry.


Docker command reference

other extensions