docker - cannot find aws credentials in container although they exist
what do you see if you run
ls -l ~/.aws/config
within your docker instance?
Mounting $HOME/.aws/
into the container should work. Make sure to mount it as read-only.
It is also worth mentioning, if you have several profiles in your ~/.aws/config
-- you must also provide the AWS_PROFILE=somethingsomething
environment variable. E.g. via docker run -e AWS_PROFILE=xxx ...
otherwise you'll get the same error message (unable to locate credentials).
Update: Added example of the mount command
docker run -v ~/.aws:/root/.aws …
You can use environment variable instead of copying ~/.aws/credentials and config file into container for aws-cli
docker run \
-e AWS_ACCESS_KEY_ID=AXXXXXXXXXXXXE \
-e AWS_SECRET_ACCESS_KEY=wXXXXXXXXXXXXY \
-e AWS_DEFAULT_REGION=us-west-2 \
<img>
Ref: AWS CLI Doc