我正在使用运行python的容器中的boto3的命令行工具:3.4 image,在我的笔记本电脑中,我可以运行代码没有问题,但在容器内部I收到以下错误:docker boto3 AWS无法验证提供的访问凭据
File "/usr/local/lib/python3.4/site-packages/botocore-1.3.26-py3.4.egg/botocore/client.py", line 310, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.4/site-packages/botocore-1.3.26-py3.4.egg/botocore/client.py", line 407, in _make_api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials
我一直在试图找出问题的原因,我发现在码头工人时区同步是可能的原因,但是我试图通过更改时区,但没有成功,这是我的Dockerfile:
#Docker container image
# Set the base image to use to Ubuntu
FROM python:3.4
MAINTAINER Dave J. Franco <[email protected]>
#Update OS
RUN apt-get update
#testing timezone
ENV TZ=America/Santiago
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#Project directory
RUN mkdir ufl
#COPY source code
COPY . /ufl
WORKDIR /ufl
#Set permission for ssh keys
RUN chmod 600 -R data/keys
RUN python3 setup.py install
CMD ['ufl']
您应该在问题中包括如何将您的凭据传递给代码,因为问题可能与此有关(也许,在容器外部,您正在与您的用户一起运行,在.aws config目录中有凭据等)。 –
我已经尝试使用环境变量和通过使用aws配置,问题似乎并没有凭据本身是aws无法验证它 –