Monday, December 31, 2018

Using AWS ECR with Docker

1) Setup Docker on Mac Pro

Download Docker from DockerHub and install
https://docs.docker.com/docker-for-mac/install/
Skip the login
A Whale icon appears on the top right corner on the Mac

From the terminal, execute docker ps or docker --version command to confirm installation.

2) Download a sample docker image
I used rabbitmq from DockerHub
https://hub.docker.com/_/rabbitmq/

From the terminal, execute docker pull rabbitmq

3) Create AWS ECR repository
Login to AWS > ECR
Create a new repository myrabbitmq
Once created, View Push Commands for instructions.

4) Upload a new image into ECR
From the terminal, execute these commands
docker image ls (List the Docker images)
$(aws ecr get-login --no-include-email --region us-east-1)
Login successful message will be displayed

docker tag excalibur:latest {your-aws-id}.dkr.ecr.us-east-1.amazonaws.com/myrabbitmq:latest
docker image ls (List the Docker images)
docker push {your-aws-id}.dkr.ecr.us-east-1.amazonaws.com/myrabbitmq:latest

Refresh ECR repository to view the uploaded image