Feedback

Chat Icon

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Docker Images
29%

Tags and Digests

Tags are human-friendly aliases for specific image versions.

When we pull an image like Alpine, Docker downloads a specific tag of that image; even if it's not explicitly mentioned, Docker assumes the latest tag by default.

docker pull alpine
# is equivalent to
docker pull alpine:latest

Using latest is not a good practice because of two main reasons:

  • latest doesn't necessarily mean that you're downloading the latest version of the image. If the developer of the image doesn't update the latest tag to point to the newest version, you may end up pulling an older version unknowingly.

  • Pulling a dynamic tag like latest is never a good idea since you don't know what you're getting. The image behind the latest tag can change over time, leading to inconsistencies in your deployments. It's better to use a fixed tag and when upgrading your Docker image, you just need to change the tag to the new version explicitly.

Examples:

# Pull the tag 3.23.2
docker pull alpine:3.23.2

# Pull the tag 3.22
docker pull alpine:3.22

# Pull the tag 3.21
docker pull alpine:3.21

# ..and so on

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Enroll now to unlock all content and receive all future updates for free.

Unlock now  $31.99$25.59

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More