✦ For everyone, free.

Practical knowledge for real and everyday life

Home

3.2.2 Image Tags

A focused guide to Image Tags, connecting core concepts with practical Docker and container operations.

Image tags are human-readable labels attached to a specific image within a repository, used to distinguish different versions of the same application and to provide a memorable way to reference a particular image without needing to use its full content digest.

Assigning a Tag

A tag is assigned either when an image is built or afterward, by associating a name with an already-existing image's content.

docker build -t myapp:1.0 .
docker tag myapp:1.0 myapp:stable

Both 1.0 and stable now point to the exact same underlying image content, since tagging does not change or duplicate the image itself.

Tags Are Mutable Pointers

Unlike the image content they point to, a tag itself can be reassigned at any time to point to different content, which is precisely why a tag alone is not a reliable guarantee of unchanging content over time.

docker build -t myapp:stable .

If this build produces different content than a previous build also tagged stable, the tag now points to the new content, and anything still referencing myapp:stable going forward retrieves the new, not the old, version.

Listing Tags for a Repository

The tags currently available for a given repository, either locally or in a remote registry, can be listed to see what versions exist.

docker images myapp
Best Practices for Tagging

Many teams reserve specific, fixed-looking tags (such as version numbers) for releases that should never be reassigned, while accepting that more general tags (such as latest or stable) are expected to move over time as new builds are published.

docker tag myapp:1.4.2 myapp:1.4.2
docker tag myapp:1.4.2 myapp:latest

The first command here is effectively a no-op since the tag already points to this content; reassigning 1.4.2 to different content later would violate the convention that version tags are fixed.

Why Tags Matter

Tags are the primary, human-friendly way most people interact with images day to day, but understanding that they are mutable pointers, distinct from the immutable content they currently reference, is essential to avoiding confusion about exactly what is running where.

Content in this section