我正在使用運行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無法驗證它 –