Docker Engine 29 reference · Images

docker tag Command (Docker CLI)

Give an existing image another name, typically a registry path and version before pushing; tags are pointers to the same image.

Docker Engine 29

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

Parameters

ParameterDescription
SOURCE_IMAGE An existing local image.
TARGET_IMAGE The new name: [registry/]repository[:tag].

Examples

Add a registry name
docker tag alpine:3.24 registry.example.com/base/alpine:3.24-approved
docker image ls registry.example.com/base/alpine --format '{{.Repository}}:{{.Tag}}'
docker image rm registry.example.com/base/alpine:3.24-approved > /dev/null

Output

registry.example.com/base/alpine:3.24-approved

Run this on your computer — see “Get Started” for setup.

Tags share one image
docker tag alpine:3.24 rc-ref-tag:a
same=$(docker image inspect alpine:3.24 rc-ref-tag:a --format '{{.Id}}' | sort -u | wc -l)
echo "distinct image IDs: $same"
docker image rm rc-ref-tag:a > /dev/null

Output

distinct image IDs: 1

Run this on your computer — see “Get Started” for setup.

Was this page helpful?