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:

docker run -e AWS_ACCESS_KEY_ID=<ACCESS_KEY> -e AWS_SECRET_ACCESS_KEY=<SECRET_KEY> ...

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 !


Categories

...