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
Syntax
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Parameters
| Parameter | Description |
|---|---|
SOURCE_IMAGE |
An existing local image. |
TARGET_IMAGE |
The new name: [registry/]repository[:tag]. |
Examples
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.
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.
Related
docker build· Build an image from a Dockerfile and a build context, with tags, build arguments, secrets, targets and platforms.docker image ls· List local images with repository, tag, ID and size; filter dangling images and format the output.- Tags, Digests and Registries · tutorial