Pulling Images from a Registry
What you'll learn: How to retrieve container images from registries and control exactly which version you get.
The Core Concept
Pulling an image is like downloading a software package from an app store—you're retrieving a packaged application from a remote storage location (the registry) to your local machine. Once pulled, you can run containers from that image. The pull operation downloads all the image layers you don't already have locally, taking advantage of layer caching to avoid redundant downloads.
How Pulling Works
When you pull an image, you specify its name using the format: registry/repository:tag. If you omit the registry, it defaults to Docker Hub. If you omit the tag, it defaults to latest.
Basic pull command:
docker pull nginx:1.24
This retrieves the nginx image, version 1.24, from Docker Hub.
Pulling from a private registry:
docker pull myregistry.com/myapp:v2.3.1
Tags vs Digests for Precision
Tags like :latest or :v1.0 are mutable—they can point to different images over time. For reproducibility and security, you can pull by digest (the immutable SHA256 hash):
docker pull nginx@sha256:abc123def456...
This guarantees you get the exact same image every time, regardless of tag changes.
Think of It This Way
Tags are like nicknames that can change who they refer to, while digests are like fingerprints—they always identify the exact same person (or in this case, image).
Key Takeaway: Pulling images retrieves them from registries to your local system; use tags for convenience and digests for guaranteed reproducibility and security.