我正在尝试在Docker容器中运行AWSEBCLI。我正在按照"Configuration Settings and Precedence"
下的文档中所述,将访问密钥和安全令牌作为env vars传递ERROR: CredentialsError - Operation Denied. You appear to have no credentials
这是我的docker文件
FROM circleci/golang
ADD . /go/src
WORKDIR /go/src
RUN sudo apt-get -y -qq update --assume-yes
RUN sudo apt-get install python-pip python-dev build-essential --assume-yes
RUN sudo pip install awscli=="1.16.9"
RUN sudo pip install awsebcli=="3.14.4"
RUN echo ${AWS_ACCESS_KEY_ID}
RUN echo ${AWS_SECRET_ACCESS_KEY}
CMD sudo eb deploy Circledocker
答案 0 :(得分:1)
您的用户会话和 sudo 会话中定义的环境不同。
"
看看man sudo,它的 -E 标志:
RUN echo ${AWS_ACCESS_KEY_ID} -> Works
RUN sudo echo ${AWS_ACCESS_KEY_ID} -> Will not provide you the value.
所以这通常可以工作:
-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their
existing environment variables. The security policy may return an error
if the user does not have permission to preserve the environment.
像这样尝试您的sudo -E bash -c 'echo $AWS_ACCESS_KEY_ID'
命令:
eb deploy
希望有帮助!