0 votes
1 view
in AWS by (19.2k points)

I have a docker container golang code which interacts with aws resources. In the testing environment, we use iam role. But How do I test locally? How to use aws credentials to run my docker locally. I am using docker file to build the docker image

1 Answer

0 votes
by (44.6k points)

Mount you credential directory as read-only using:

docker run -v ${HOME}/.aws/credentials:/root/.aws/credentials:ro  ...

given you have root as the user in the container and also have set up the host using this guide for credentials file.

pass them into your Environment Variables directly:


If you are willing to learn more about Docker, then you can join Docker Certification Course

Welcome to Intellipaat Community. Get your technical queries answered by top developers !