docker tag Explained
What docker tag does, with an example.
Published November 9, 2026
docker tag gives an image an additional name (repository:tag) without copying it, typically to version it or prepare it for pushing to a registry.
How it works
An image ID can have many tags. Good practice: tag with a version and also the commit SHA, and avoid relying on :latest.
Tags are mutable labels; digests are immutable.
Try it
docker tag myapp:1.0 ghcr.io/me/myapp:1.0
docker images | grep myapp
myapp 1.0 d4e5f6
ghcr.io/me/myapp 1.0 d4e5f6
Practical examples
Add a registry tag
docker tag myapp:1.0 ghcr.io/me/myapp:1.0Tag with git SHA
docker tag myapp:1.0 myapp:$(git rev-parse --short HEAD)Tag at build time
docker build -t myapp:1.0 -t myapp:latest .Remove a tag
docker rmi myapp:oldCommon mistakes
- Overwriting tags used in production.
- Only using :latest.
- Forgetting registry prefix before push.
Key takeaways
- docker tag gives an image an additional name (repository:tag) without copying it, typically to version it or prepare it for pushing to a registry.
- Run docker <command> --help for all options.
- Clean up unused resources regularly.
FAQ
Tag vs digest?
Tags can move; digests always point to the same content.
Where can I see all options?
Run the command with --help.