Right now I'm grabbing the ecr password via a command and piping it in to docker login
to authenticate my docker client with the ECR registry
aws ecr get-login-password --region 'us-east-1' | \
docker login --username AWS --password-stdin <my-aws-acct-id>.dkr.ecr.us-east-1.amazonaws.com
Is there a command to tell if my docker client is already authenticated with ECR?
I tried to look at info in docker info
and some other commands but it doesn't work to tell me if my docker is logged into ECR
The below doesn't work, but something like this in my shell script would be ideal:
if docker info | grep -q "<my-aws-acct-id>.dkr.ecr.us-east-1.amazonaws.com"; then
echo "Already logged in to ECR ✅"
else
echo "Not logged in to ECR"