To authenticate Docker client with ECR

Once we have our repository in place in AWS ECR, and assuming AWS CLI is installed in the server from where the Docker client is authenticating and pushing the image, we need to perform the following steps:

  1. We need to retrieve the ecr login credentials by entering the following command:
     aws ecr get-login --no-include-email
  1. Once we run the preceding command, we will get the ECR Docker Registry Login credentials. If you check the output of your command, it will be docker login -u Username -p PasswordString ECRRegistryURL:
    root@awsstar:~# aws ecr get-login --no-include-email docker login -u AWS -p eyJwYXlsb2FkIjoiYW5FRXRPVE5sc0pxODVxOGQ3VkI1bUlqeVJlT1FJZHpFd0JMaVVBdWs0RVZTaFlDRWRZd0JUSEtFODY0QUEyMkFYMXVXSkkwM3ZXeFpqam5EU3E1QnpENVFHcHhScmZuQWRZVExrTE1BaUpscnBaVXhWSE5HQ3hCVHZaVVBsRERyRHVUYy9LMHc2WEdRSTdtbjk0cXJPVXdyajZnTWJ4NmYzSDlSeGEvdmU0aUcvTkh0ZSt0S0RRdk8zZUltSE1QZGRKdHdGcHpVSG1McUdWQ0habTV2bUhMbTlQZGxvUk9DRnNlaG5QM2g1eVNkTGo0Smp1U1VJYUZrUysya1Bk= ...

Get AWS Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.