Skip to content

Instantly share code, notes, and snippets.

@itskingori
Last active April 7, 2017 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save itskingori/43b59e47b6bce65ef5bf4f2fec1e35c4 to your computer and use it in GitHub Desktop.
Save itskingori/43b59e47b6bce65ef5bf4f2fec1e35c4 to your computer and use it in GitHub Desktop.
Authenticate into AWS ECR. Useful in a CI environment (to push images) ... and so on. If you're unhappy evaluating unvalidated commands ... this adds a regex that checks the output from get-login.
# See https://forums.aws.amazon.com/thread.jspa?threadID=222215
aws_login=$(aws ecr get-login --region us-east-1);
if echo "$aws_login" | grep -q -E '^docker login -u AWS -p \S{1092} -e none https://[0-9]{12}.dkr.ecr.\S+.amazonaws.com$'; then $aws_login; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment