Push Docker Images to AWS ECR

Docker is a great containerization platform for running isolated applications. A container is an application or service that’s been bundled with all its dependencies. This bundle is called an image.

I will use these commands to create an api image and push it to the registry:

# authenticate with aws ecr
aws ecr get-login-password --region {REGION} |\
    docker login --username AWS \
    --password-stdin {AWSID}.dkr.ecr.{REGION}.amazonaws.com

# build image 
docker build -t api .

# tag image 
docker tag api:latest {AWSID}.dkr.ecr.{REGION}.amazonaws.com/api:latest

# push to ecr
docker push {AWSID}.dkr.ecr.{REGION}.amazoneaws.com/api:latest
  • {REGION} : replace with your region
  • {AWSID} : replace AWS account number/id