How to create a Docker image tag?

QuestionsQuestions8 SkillsProYour First Docker LabOct, 09 2025
0115

To create a Docker image tag, you can use the docker tag command. Here’s how to do it:

  1. Pull or have an existing image: First, ensure you have the image you want to tag. For example, let's say you want to tag the nginx:latest image.

  2. Use the docker tag command: The syntax for tagging an image is as follows:

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

    Here’s an example command to create a new tag for the nginx:latest image:

    docker tag nginx:latest my-nginx:v1

    In this command:

    • nginx:latest is the source image and tag.
    • my-nginx is the new image name you are creating.
    • v1 is the new tag you are assigning.
  3. Verify the tagged image: You can list your images to see the new tag using:

    docker images

You should see both nginx:latest and my-nginx:v1 in the list, indicating that the tagging was successful.

0 Comments

no data
Be the first to share your comment!