Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k 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.4k 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

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...