简体   繁体   中英

Does anyone have a sample buildspec for pushing single built docker image into two different ECR on different AWS accounts?

Can this be done and would I need to login twice in the buildspec?

Looking at completing a build, then on success, to push this image to the same account, as well as two other accounts. Anyone have or know if this can be done within the buildspec?

if this can be done within the buildspec

it lets you define any commands, and all you need console commands. So i would say - yes.

To push image into the AWS ECR you need to execute command docker login..... which uses token. but there is a aws ecr get-login command which can help you with it. so you need to have installed and configured aws ecr and then you can do this to login you docker into ecr:

  1. $(aws ecr get-login --no-include-email --region {your ECR region})

  2. after that you can do docker push imagename:latest

repeat 1-2 steps as many times as you need.

  1. cleanup local mess.

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