Home > front end >  AWS ECR layer already exists when pushing a updated docker version
AWS ECR layer already exists when pushing a updated docker version

Time:10-22

Scenario: Created a new ECR private repo and pushed a new docker in it successfully. Then used that docker image to host the application. Now application needed some updated APIs so:

  1. made changes to the code.
  2. followed AWS commands to push the updated docker image in the same repo with different version number. Also while creating docker I removed the the local docker images from my pc and used the --no-cache tag as well.

While uploading I got Layers already exits for all layers except 1 (with size around 32 mb), it got pushed in 10 seconds. On ECR I can see the new updated version of the image with size same as the previous version but only around 32 mb layer was pushed in 5,10 seconds. What does this mean? I tried the whole process a couple of times and randomly one time it said Layer already exists for all layers expect 2. This time a layer with proper image size (around 330 mb) got pushed.

Could someone explain what is the best way to update your version on ECR with proper image pushes?

CodePudding user response:

this is not a big concern because when we talk about docker image it has multiple build layers, so when you are pushing it on aws ecr it pushes multiple layers of image in ecr repository,and when you are update your changes and build this image and pushed new version of image in ecr it only pushes the updated layer of docker image, because other layers are already available in your ecr repository. I hope you understand this.

  • Related