Forrest logo
back to the docker tool

docker:tldr:9277f

docker: Display help.
$ docker tag
try on your machine

The docker tag command is used to add a new name and/or tag to an existing image in Docker. It allows you to create an alias or make a copy of an image with a different name or tag.

The syntax for the docker tag command is as follows:

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

Here, SOURCE_IMAGE refers to the image you want to tag, and TARGET_IMAGE refers to the new name and/or tag you want to assign to the image.

For example, suppose you have an image called myimage that currently has the latest tag. You can tag it with a new name and a different tag using the docker tag command like this:

docker tag myimage:latest newimage:1.0

This will create a new image called newimage with the tag 1.0, which is essentially a copy of the original image.

You can also use the docker tag command to create multiple tags for the same image. For instance:

docker tag myimage:latest myimage:2.0

This will add a new tag (2.0) to the existing image (myimage), so you can refer to it using either tag.

Tags serve as human-readable labels to identify or version your images. They can help manage different versions of the same image or facilitate deployment to different environments.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool