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:
$(aws ecr get-login --no-include-email --region {your ECR region})
after that you can do docker push imagename:latest
repeat 1-2 steps as many times as you need.
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.