简体   繁体   English

docker容器中的'aws configure'不会使用环境变量或配置文件

[英]'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 configureget 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.

相关问题 如何更改 AWS Fargate 上的 Grafana docker 容器环境变量以使用 mysql 数据库 - How do I change Grafana docker container environment variables on AWS Fargate to use a mysql database AWS上的Docker-环境变量未从主机继承到容器 - Docker on AWS - Environment Variables not inheriting from host to container AWS XRay SDK 无法读取 docker 容器内的环境变量 - AWS XRay SDK fails to read environment variables within a docker container 如何在 AWS-ECR 中为 docker 映像使用环境变量? - How to use environment variables for a docker image in AWS-ECR? Mulicontainer Docker AWS 上的环境 Elasticbeanstalk 环境变量 - Mulicontainer Docker Environment on AWS Elasticbeanstalk environment variables 在AWS Multicontainer Docker环境中部署到特定容器 - Deploying to specific container in AWS multicontainer docker environment 在docker容器中获取弹性beanstalk环境变量 - Get elastic beanstalk environment variables in docker container AWS Elastic Beanstalk Docker环境变量 - AWS Elastic Beanstalk Docker environment variables 如何为在 AWS ECS 中运行的 Docker 容器配置“ulimits”? - How do I configure "ulimits" for a Docker container running in AWS ECS? AWS Elastic Beanstalk环境变量不会从配置文件更新 - AWS Elastic Beanstalk environment variables do not update from config file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM