简体   繁体   中英

Tag problem while pushing docker Image to AWS ECR

I have wanted to push my docker image to AWS ECR. After log in into aws ecr using terminal, I have to tag my image for aws ECR. It seems it creates new image beside old image after tagging for aws ecr.

How can I tag my existing images for aws ECR without creating new images and push to aws ECR? Is there any way to define it in docker compose file?

In order to retag Docker Image pushed with tag "latest" originally then you need to put a new tag here .

Docker Command to rename a tag is :

docker tag <old_tag> <new_tag>

where <new_tag> should be

repository:tag

  • repository : "502341150717.dkr.ecr.us-east-2.amazonaws.com/app_app"
  • tag : "dev.latest" or "prod.latest" (or anything else except "latest")

Hence the command that should work will be :

docker tag app_app:latest 502341150717.dkr.ecr.us-east-2.amazonaws.com/dev.latest

FYI : "app_app" is the name of your ECR Repository where images are stored and it is not the name of your image as mentioned in the comment's. Your original image was tagged as 'latest' and your are renaming it to 'latest' again, hence it doesn't work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM