[英]'aws configure' in docker container will not use environment variables or config files
So I have a docker container running jenkins and an EC2 registry on AWS. 所以我在AWS上有一个运行jenkins和EC2注册表的docker容器。 I would like to have jenkins push containers back to the EC2 registry. 我想让jenkins将容器推回EC2注册表。
To do this, I would like to be able to automate the aws configure
and get login
steps on container startup. 为此,我希望能够自动化aws configure
并get login
容器启动时的get login
步骤。 I figured that I would be able to 我想我能够
export AWS_ACCESS_KEY_ID=*
export AWS_SECRET_ACCESS_KEY=*
export AWS_DEFAULT_REGION=us-east-1
export AWS_DEFAULT_OUTPUT=json
Which I expected to cause aws configure
to complete automatically, but that did not work. 我预计会导致aws configure
自动完成,但这不起作用。 I then tried creating configs as per the AWS docs and repeating the process, which also did not work. 然后我尝试根据AWS文档创建配置并重复该过程,这也无效。 I then tried using aws configure set
also with no luck. 然后我尝试使用aws configure set
也没有运气。
I'm going bonkers here, what am I doing wrong? 我在这里疯狂,我做错了什么?
No real need to issue aws configure
instead as long as you populate env vars 只要您填充env变量,就不需要发出aws configure
export AWS_ACCESS_KEY_ID=aaaa
export AWS_SECRET_ACCESS_KEY=bbbb
... also export zone and region
then issue 然后问题
$(aws ecr get-login --region ${AWS_REGION} )
you will achieve the same desired aws login status ... as far as troubleshooting I suggest you remote login into your running container instance using 您将获得相同的所需aws登录状态...就故障排除而言,我建议您使用远程登录到正在运行的容器实例
docker exec -ti CONTAINER bash
then manually issue above aws related commands interactively to confirm they run OK before putting same into your Dockerfile
然后以交互方式手动发出上面的aws相关命令,确认它们在将其放入Dockerfile
之前运行正常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.