ECR is not deleting images; how to force layer upload

3

After deleting ECR images, uploading a new version does not actually upload the version but instead I get all "layer already exists" messages. How do I actually delete the images so that I can force a fresh upload? The layers that "already exist" are NOT the same as the ones that I am trying to upload and I can't see any way to force the upload other than to delete all the images in the repository which doesn't work.

Thanks!

  • Hello, how are you uploading these images to ECR? From your local machine, CodeBuild, or somewhere else? Also, how are you deleting these images? Manually via the console, through the CLI, or another method? The more details you can provide, the better.

  • Over half a year and still no solution for this... Does AWS support ever read these?

  • I had to delete the image image and create another one with the same name to do so.

  • Any solution for this?

HooHost
asked 2 years ago2335 views
1 Answer
-1

Its likely that the old image layers are not being re-built when you are building the image.

Prior to the docker build, try to force delete all of the depending image layers and see if it helps.

docker rmi -f <ImageID>
docker build -t <Image:Tag> . --no-cache
docker push <Image:Tag>

Also, it would help us understand the issue if you can provide more context like where and how you are building/deleting these images.

If the above steps do not work, please feel free to reach out to AWS Support for further troubleshooting.

profile pictureAWS
SUPPORT ENGINEER
answered 2 years ago
  • I'm uploading using the CLI. I am deleting the image manually from the ECR web admin page. It shouldn't matter if I am trying to upload the exact same image, once I delete it it should be gone permanently, the very last thing that should happen is that AWS keeps an archived copy of our deleted image layers, especially the ones that are not public! This is undesirable on so many levels. When I try to upload the exact same image, it should need to be uploaded because no copy exists on AWS, period. It doesn't matter if I built an entirely new one, tagged it with something, or did nothing to it at all.

    What is actually happening: - I delete all the images from the ECR repository page. It is empty. Nothing is shown. Blank list. - I upload the image from my remote machine using the AWS CLI - AWS CLI on remote machine instantly spits out "layer already exists" for the 20 or so layers - Old deleted image is magically back on ECR.

    It is NOT uploading the same image again, it is 500MB and it would not be instant (in previous uploads it took several minutes). It is restoring it from a hidden trash folder or something, it still exists on AWS - this needs to be disabled permanently. We CANNOT have AWS storing/archiving deleted ECR images under any circumstances whatsoever. Perhaps there is an ECR setting to automatically archive instead of permanently deleting, that I don't know about?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions