CrackOps
Interview PrepTracksLinuxAWS LabSoonInterview RoomSoon
Sign inStart free
CrackOps

Interview prep for the people who keep production up.

[email protected]
ProductInterview PrepTracksDashboardInterview Room
RolesDevOpsSREPlatformCloud
CompanyAboutContactPrivacyTerms
© CrackOps
Linux / Docker / docker pull

docker pull

Download an image from a registry

Beginnerimagesregistrysupply-chain

docker pull downloads an image (its manifest and any layers you don't already have) from a registry such as Docker Hub, ECR or GHCR into the local store. Pull by tag for convenience, by digest for an exact, repeatable build.

Syntaxdocker pull [OPTIONS] [REGISTRY/]NAME[:TAG|@DIGEST]

Watch it run

You want an image on this host before a deploy, so the container starts instantly instead of downloading first.

devops@devops-lab: ~ — zsh — 96×28
➜ ~
Step 1 of 3
docker pull alpine:3.20

Docker resolved alpine:3.20 to docker.io/library/alpine:3.20, fetched its manifest and downloaded the one missing layer. The digest identifies exactly this build; the last line is the fully qualified name.

Anatomy of a command

$
commanddocker pull

Fetch an image from a registry into the local image store without running it.

How it works

dockerd expands the reference (nginx becomes docker.io/library/nginx:latest) and speaks the OCI distribution API over HTTPS. The first request gets 401 with a pointer to the registry's token service; dockerd fetches a bearer token, anonymously or with credentials from ~/.docker/config.json or a credential helper. It then GETs /v2/<repo>/manifests/<tag>. For multi-platform images that returns an index, from which it picks the manifest for linux/amd64 (or --platform). The manifest lists a config blob and layer blobs by sha256. Layers already in the local store are skipped; the rest are downloaded in parallel, checked against their digest, decompressed and unpacked into snapshots. Finally the tag is pointed at the new image. The image ID only changes if the content did.

A token, a manifest lookup by tag, a platform choice, and then only the layers you don't already have.

pull nginxget tokenGET manifestresolve tagGET blobsunpack + tagYoudocker pulldockerddistribution APIdocker.io/libraryToken serviceauth.docker.ioRegistry/v2/ APIManifestindex -> amd64Layer blobssha256:...Image storecontainerd
1/7
Expand the name

nginx:1.27-alpine becomes docker.io/library/nginx:1.27-alpine: default registry Docker Hub, official images under library/, and :latest if no tag is given.

← → to step

Options you'll actually use

--platform OS/ARCHPull a specific variant, like linux/arm64 or linux/amd64
-a, --all-tagsPull every tag of the repository (rarely what you want)
-q, --quietPrint only the final image name
NAME@sha256:DIGESTPull an exact, immutable image instead of a moving tag
--disable-content-trustSkip image signature checks (they're off unless DOCKER_CONTENT_TRUST=1)

Common mistakes

FROM node or image: postgres with no tag in production

That means :latest, which changes under you; the next deploy may silently get a new major version.

Pin a version tag (postgres:16.4) or a digest (postgres@sha256:...)
Assuming docker run always gets the newest image

run only pulls when the image is missing locally. An old copy of :latest will be used as-is.

docker pull first, or docker run --pull always
Letting every CI job pull base images anonymously from Docker Hub

Rate limits are per IP; a busy runner pool behind one NAT address hits them and builds fail randomly.

Log in, or use a registry mirror or ECR pull-through cache

Interview questions

Practice

Try these on a Linux machine of your own. Each task has a hint and a solution.

  1. 1

    Write the fully qualified form of the image reference 'redis' (registry, repository and tag) that docker pull actually uses, then pull it by that name.

  2. 2

    Write the command to pull the arm64 variant of nginx:1.27-alpine onto an x86 build machine.

  3. 3

    In the sandbox, compute the sha256 of a file in ~/data the same way a registry checks a layer blob.

  4. 4

    In the CrackOps AWS Lab, log in to ECR and pull the shop-api image. Write the two commands.

Related commands

docker pushUpload an image to a registrydocker imagesList, filter and clean up local imagesdocker runCreate and start a container from an imagedocker buildBuild an image from a Dockerfile
Previousdocker imagesNextdocker push
Linux / Docker / docker pull

docker pull

Download an image from a registry

Beginnerimagesregistrysupply-chain

docker pull downloads an image (its manifest and any layers you don't already have) from a registry such as Docker Hub, ECR or GHCR into the local store. Pull by tag for convenience, by digest for an exact, repeatable build.

Syntaxdocker pull [OPTIONS] [REGISTRY/]NAME[:TAG|@DIGEST]

Watch it run

You want an image on this host before a deploy, so the container starts instantly instead of downloading first.

devops@devops-lab: ~ — zsh — 96×28
➜ ~
Step 1 of 3
docker pull alpine:3.20

Docker resolved alpine:3.20 to docker.io/library/alpine:3.20, fetched its manifest and downloaded the one missing layer. The digest identifies exactly this build; the last line is the fully qualified name.

Anatomy of a command

$
commanddocker pull

Fetch an image from a registry into the local image store without running it.

How it works

dockerd expands the reference (nginx becomes docker.io/library/nginx:latest) and speaks the OCI distribution API over HTTPS. The first request gets 401 with a pointer to the registry's token service; dockerd fetches a bearer token, anonymously or with credentials from ~/.docker/config.json or a credential helper. It then GETs /v2/<repo>/manifests/<tag>. For multi-platform images that returns an index, from which it picks the manifest for linux/amd64 (or --platform). The manifest lists a config blob and layer blobs by sha256. Layers already in the local store are skipped; the rest are downloaded in parallel, checked against their digest, decompressed and unpacked into snapshots. Finally the tag is pointed at the new image. The image ID only changes if the content did.

A token, a manifest lookup by tag, a platform choice, and then only the layers you don't already have.

pull nginxget tokenGET manifestresolve tagGET blobsunpack + tagYoudocker pulldockerddistribution APIdocker.io/libraryToken serviceauth.docker.ioRegistry/v2/ APIManifestindex -> amd64Layer blobssha256:...Image storecontainerd
1/7
Expand the name

nginx:1.27-alpine becomes docker.io/library/nginx:1.27-alpine: default registry Docker Hub, official images under library/, and :latest if no tag is given.

← → to step

Options you'll actually use

--platform OS/ARCHPull a specific variant, like linux/arm64 or linux/amd64
-a, --all-tagsPull every tag of the repository (rarely what you want)
-q, --quietPrint only the final image name
NAME@sha256:DIGESTPull an exact, immutable image instead of a moving tag
--disable-content-trustSkip image signature checks (they're off unless DOCKER_CONTENT_TRUST=1)

Common mistakes

FROM node or image: postgres with no tag in production

That means :latest, which changes under you; the next deploy may silently get a new major version.

Pin a version tag (postgres:16.4) or a digest (postgres@sha256:...)
Assuming docker run always gets the newest image

run only pulls when the image is missing locally. An old copy of :latest will be used as-is.

docker pull first, or docker run --pull always
Letting every CI job pull base images anonymously from Docker Hub

Rate limits are per IP; a busy runner pool behind one NAT address hits them and builds fail randomly.

Log in, or use a registry mirror or ECR pull-through cache

Interview questions

Practice

Try these on a Linux machine of your own. Each task has a hint and a solution.

  1. 1

    Write the fully qualified form of the image reference 'redis' (registry, repository and tag) that docker pull actually uses, then pull it by that name.

  2. 2

    Write the command to pull the arm64 variant of nginx:1.27-alpine onto an x86 build machine.

  3. 3

    In the sandbox, compute the sha256 of a file in ~/data the same way a registry checks a layer blob.

  4. 4

    In the CrackOps AWS Lab, log in to ECR and pull the shop-api image. Write the two commands.

Related commands

docker pushUpload an image to a registrydocker imagesList, filter and clean up local imagesdocker runCreate and start a container from an imagedocker buildBuild an image from a Dockerfile
Previousdocker imagesNextdocker push