What does an image tag do?
A tag on an image is a pointer to a specific version of the image within a repository. It helps distinguish one build from another and choose exactly which version to run or download.
Why a tag is needed
- distinguish versions (
1.0,2.0,alpine,dev) - manage updates
- unambiguously reference a specific image
Example
javascript
docker pull nginx:1.25downloads a specific version, while:
javascript
docker pull nginx:latesttakes the default version, marked as latest.
An important detail
A tag is not a copy, just a label that points to a certain image. The same image can have several tags.
Summary: a tag is a version label of a Docker image that lets you unambiguously identify the build you need.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.