Build a docker image on AWS Codebuild based on an image pulled from an ECR of another user: “no basic auth credentials”

让人想犯罪 __ 提交于 2019-12-25 01:37:21

问题


I have a line in my Dockerfile like this:

FROM 6*********.dkr.ecr.ap-southeast-1.amazonaws.com/*************:ff03401

This ECR is owned by another user.

As recommended in this question, I am trying to log in by using these commands in the build section of my buildspec.yml, and then immediately pull this docker image:

- aws configure set aws_access_key_id $ECR_ACCESS_KEY
- aws configure set aws_secret_access_key $ECR_SECRET_KEY
- eval aws ecr get-login --no-include-email --region ap-southeast-1 --registry-ids 6***********
- docker pull 6***********.dkr.ecr.ap-southeast-1.amazonaws.com/****************:ff03401

When I look at the Codebuild logs, I see that eval aws ecr get-login... outputs a docker login ... command which, if I run it on my local machine, logs me in successfully, and lets me do the docker pull 6******....

In Codebuild, however, docker pull says:

Error response from daemon: Get https://6**********.dkr.ecr.ap-southeast-1.amazonaws.com/v2/******************/manifests/ff03401: no basic auth credentials

I have also tried adding --profile ecrproduction to the first three commands, without success.

来源:https://stackoverflow.com/questions/56973938/build-a-docker-image-on-aws-codebuild-based-on-an-image-pulled-from-an-ecr-of-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!