Docker pull Command
docker pull The command is used to pull (download) images from a Docker registry (such as Docker Hub) to the local machine.
docker pull The command allows users to obtain the required images to run containers locally.
Syntax
docker pull [OPTIONS] NAME[:TAG|@DIGEST]
NAME: Image name, usually including the registry address (such asdocker.io/library/ubuntu)。TAG(Optional): Image tag, default islatest。DIGEST(Optional): The 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 an image with the default tag (latest)**
docker pull ubuntu
This pulls the 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 pulls the 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 an image from a custom registry**
docker pull myregistry.com/myrepo/myimage:mytag
This pulls 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
Example output:
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 specific tag
docker pull ubuntu:20.04
Example output:
20.04: Pulling from library/ubuntu
Digest: sha256:67890abcdef...
Status: Downloaded newer image for ubuntu:20.04
docker.io/library/ubuntu:20.04
Notes
- The default tag is
latest, but it is best to explicitly specify a tag to avoid pulling an unexpected version. - Ensure there is enough disk space to store the pulled images.
- In production environments, it is recommended to use the image digest to ensure uniqueness and consistency of the image.
docker pull The command is a basic tool for obtaining Docker images; by specifying an image name, tag, or digest, you can download the required image from a Docker registry.
Docker Command Reference