- Newest
- Most votes
- Most comments
Hello,
please try this solution it will be helpful for you.
Step 1:
To pass AWS credentials and configuration to a Docker container in a straightforward way, start by creating the .aws directory on your host machine with the necessary credentials and config files containing your AWS access key, secret key, session token, and region.
Step 2:
the Next create a simple Dockerfile for your Flask app, copy your application code, and install the required dependencies.
Step 3:
Build your Docker image using docker build -t my-flask-app .. Finally, run the Docker container while mounting the **.aws **directory from your host to the container using docker run -d -p 5000:5000 -v ~/.aws:/root/.aws my-flask-app. This method allows the container to securely access AWS credentials without embedding them directly into the Docker image.
please look at Docker document link you will get more information.
https://docs.docker.com/get-started/09_image_best/
https://docs.aws.amazon.com/sdkref/latest/guide/file-location.html
Relevant content
asked 3 years ago
