latest tag, pulling specific versions, listing local images, removing tags, and pinning by tag or digest.
Default behavior: latest
If you run an image without a tag, Docker uses the latest tag by default. This is a convention maintained by image authors and usually points to what they consider the current release.
Example (omitting a tag):
To discover available tags and what
latest points to for a specific image, check the image’s repository page on Docker Hub — it lists all supported tags, variants (like -alpine), and their meanings.Listing and removing images
To view all images stored locally:docker rmi removes only the tag reference. The image layers are deleted only when no other tags or containers (running or stopped) reference them.
Tag forms and examples
Common ways you will see tags used:
For absolute immutability use a digest (for example
redis@sha256:...). This ensures you pull the exact same image manifest every time. See Docker docs for pulling by digest: https://docs.docker.com/engine/reference/commandline/pull/#pull-an-image-by-digest
Quick command reference
Do not rely on
latest in production. Always specify an explicit, immutable tag (for example redis:7.4-alpine or redis:8.6.1), or pin to a digest, to ensure reproducible builds and predictable deployments.Best practices
- Pin images in production manifests to specific tags or, preferably, digests to avoid accidental upgrades.
- Use variant tags (e.g.,
-alpine) if you need smaller images or a different base image. - Keep tags consistent across CI/CD and deployment manifests to avoid drift.
- Regularly review and update pinned versions as part of your release/update strategy; schedule tests before upgrading.
Links and references
- Docker Hub — search image repositories and view supported tags
- Docker documentation: Pull an image by digest — https://docs.docker.com/engine/reference/commandline/pull/#pull-an-image-by-digest