What You'll Learn
Beginner
- How to search for and pull images from Docker Hub
- The difference between tags, versions, and digests
- How to choose the right image (official vs community)
Searching for Images
Terminalbash
# Search from the command line
docker search nginx
# Or browse https://hub.docker.com in your browserPulling Images
Terminalbash
# Pull the latest tag (not recommended for production)
docker pull nginx
# Pull a specific version
docker pull nginx:1.25.3
# Pull an Alpine-based variant (smaller)
docker pull nginx:alpine
# Pull by digest (immutable — always gets the exact same image)
docker pull nginx@sha256:abc123...Tags vs Digests
| Tags | Digests |
|---|---|
| Human-readable label | SHA256 hash of the image |
| Can change over time | Immutable — never changes |
nginx:1.25 | nginx@sha256:abc123... |
When to use digests
In production, use digests for guaranteed reproducibility. nginx:1.25 might point to a different image tomorrow. A digest always points to the exact same image.Image Variants — slim, alpine, full
| Tag | Size | When to use |
|---|---|---|
python:3.11 | ~900 MB | Full Debian — maximum compatibility |
python:3.11-slim | ~150 MB | Stripped Debian — smaller, good default |
python:3.11-alpine | ~50 MB | Alpine Linux — smallest, may have compatibility issues |
Practical Exercise
Run
docker search pythonRun
docker pull python:3.11-slimRun
docker images — see the sizeRun
docker image inspect python:3.11-slimKey Takeaways
docker pull <image>:<tag>downloads an image from Docker Hub.- Tags are human-readable but mutable. Digests (SHA256) are immutable.
- Use official images for security. Review community images before using.
- Variants: full (compatible), slim (balanced), alpine (smallest).
- In production, pin versions or use digests. Avoid
latest.
Comments
Comments
Post a Comment