Search code examples
amazon-web-servicesdockeramazon-ecrdocker-builddocker-push

Clone Docker image with a different tag/sha


I want to push a Docker image to AWS multiple times with incremented version numbers. I'm basically wanting to clone the same image with a different SHA each time. I'm running into an issue where my repo is showing the version numbers on the same line, because they share the same SHA. Do I just need to change something within the files, or can this be done during the build/tagging process?

Here is what my repo looks like vs what I want it to look like.

My AWS repo: my repo

Demo AWS repo: demo repo

I'm not finding anything specific to this problem. Any links or assistance would be appreciated!

I'm doing:

docker build -t <tag>:1.0

docker tag <tag>:1.0 xxxxx.dkr.ecr.....<tag>:1.0

docker push xxxxx.dkr.ecr.....<tag>:1.0

and doing it all again with 1.1 appended instead of 1.0


Solution

  • I'm going to post a couple of the comments I received as the answer:

    The SHA is generated from the contents of the image. If the contents of the image are exactly the same, then the SHA will always be the same. You are pushing the same image each time, and all Docker repositories will understand that this is the same image and simply update/add any new tags to the image that is already stored in the repository. This is a feature of image repositories. It is working as intended, while you are expecting it to do something completely different. – Mark B

    If you do want different images you could eg write a small text file to each one with a simple Dockerfile. – Rup