SyntaxStudy
Sign Up
Docker Pulling, Tagging, and Inspecting Images
Docker Beginner 1 min read

Pulling, Tagging, and Inspecting Images

Docker images are stored in registries and identified by a reference of the form [registry/]repository[:tag][@digest]. When the registry is omitted, Docker defaults to Docker Hub. When the tag is omitted, Docker defaults to latest — a convention, not a guarantee of recency. Always pin a specific version tag in production to ensure reproducible deployments. Image digests are SHA256 hashes of the image manifest and are immutable unlike tags, which can be reassigned. For the highest reproducibility, pin both tag and digest. The digest can be found with docker inspect or on the Docker Hub image page. Local image management involves tagging images for pushing to different registries or renaming them for clarity. docker tag source:tag target:tag creates an alias without copying data — both names point to the same layers. Regularly pruning unused images with docker image prune or docker system prune prevents disk exhaustion on build machines.
Example
# Pull a specific version (always prefer over 'latest')
docker pull node:20.14-alpine3.20

# List images with details
docker images
docker images node
docker images --filter "dangling=true"

# Inspect image metadata
docker inspect node:20-alpine
docker inspect node:20-alpine \
  --format '{{.Config.Cmd}}'
docker inspect node:20-alpine \
  --format '{{.RootFS.Layers}}'

# Tag for a private registry
docker tag node:20-alpine myregistry.io/myteam/node:20-alpine
docker tag myapp:latest   myregistry.io/myteam/myapp:1.2.3

# Search Docker Hub
docker search nginx --filter is-official=true --limit 5

# Remove images
docker rmi node:20-alpine
docker image prune -f
docker image prune -a -f