A simple script to get valid credentials for accessing ECR
10K+
This is a simple script to get valid credentials for accessing ECR. The script will get the credentials and print a valid Docker config file to stdout.
This script requires valid AWS credentials, which can be provided in different ways.
You can mount your credentials file and run the container like this:
docker run --rm -v /path/to/.aws/credentials:/root/.aws/credentials thepeak/ecr-get-credentials > your-docker-auth-file.json
You can provide the credentials using environment variables to the container like this:
docker run --rm -e AWS_ACCESS_KEY_ID=xxxx -e AWS_SECRET_ACCES_KEY=yyyy thepeak/ecr-get-credentials > your-docker-auth-file.json
In this case you don't have to do anything special to run the container, just make sure your EC2 instance has a role that gives it access to ECR.
docker run --rm thepeak/ecr-get-credentials > your-docker-auth-file.json
Content type
Image
Digest
Size
29.9 MB
Last updated
over 8 years ago
docker pull thepeak/ecr-get-credentials