LinuxCommandLibrary

docker-tag

Tag Docker images with a new name

TLDR

View documentation for the original command

$ tldr docker image tag
copy

SYNOPSIS

docker tag [OPTIONS] IMAGE[:TAG] [REPOSITORY[:TAG]]

DESCRIPTION

The docker tag command creates a new tag for an existing Docker image, acting as a lightweight alias or reference to the same image ID. It does not copy image layers or create a new image, making it efficient for storage and management.

This is essential for workflows like versioning images (e.g., tagging 'latest' as 'v1.2'), preparing for registry pushes by prefixing with registry hosts (e.g., 'myregistry.com/myapp'), or organizing local images. Tags follow the format REPOSITORY[:TAG], where omitting :TAG defaults to 'latest'.

Source is specified as IMAGE[:TAG], and target as [REPOSITORY[:TAG]]. Multiple tags can point to one image, enabling flexible naming without duplication. Use docker images to list tags.

CAVEATS

Overwrites existing tags silently; remove with docker rmi first if needed.
No validation of target registry accessibility.
Multi-platform images require matching arches.

EXAMPLES

docker tag alpine:latest myapp:v1
docker tag myimage registry.example.com/myimage:prod
docker tag fedora fedora:26 fedora:fc26

NOTES

Tags are local to Docker daemon; push with docker push to share.
Image digests remain unchanged.

HISTORY

Introduced in Docker 0.6.0 (2013) as core CLI for image tagging; evolved with multi-arch support in Docker 17.06+ and registry v2 features.

SEE ALSO

docker-images(1), docker-push(1), docker-pull(1), docker-rmi(1), docker-build(1)

Copied to clipboard