Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to duplicate/clone an image inside same AWS ECR repository with different tag?

I have an existing image inside an ECR repo with the tag "780" and I wanted to make a copy of it inside the same repo with the tag "781". I tried executing the below commands which I found from here but that gives a new tag to the same image when given the same repo.

docker login REPO
docker pull REPO/IMAGE:TAG
docker tag REPO/IMAGE:TAG REPO/IMAGE:NEWTAG
docker push REPO/IMAGE:NEWTAG

Is there an API or utility (preferably in python) or any other way using which this can be achieved?

like image 600
Jay Shah Avatar asked Sep 01 '25 17:09

Jay Shah


1 Answers

It's not possible to have two Docker images in the same repo with the same SHA256 hash. The Docker repository is saving space by detecting that they are the same image, so it is simply adding the tags to the image that already exists in the repo. This is working as intended.

like image 119
Mark B Avatar answered Sep 05 '25 07:09

Mark B