skip to Main Content

When we create a docker image we can tag the image using -t argument.
docker build -t my-image-name:latest

But I keep updating the image. So the new image will become latest and previous image will be old. But two images cannot have the same latest tag. How do we solve this issue?

2

Answers


  1. Why don’t you use a versioning strategy like semantic versioning to tag images?
    You can use a version like v1.0.0.

    Login or Signup to reply.
  2. We apply a couple (or more) tags while building an image:
    docker build -t my-image:1.0 -t my-image:latest

    In new version we use the same technique:
    docker biuld -t my-image:1.1 -t my-image:latest

    As far as i know it works exactly this way – latest tag does float between images.

    Docs for docker build command.
    You can create a new tag explicitly referring to specific image.

    Cheers!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search