Revisiting AWS ECS: deploying Docker containers to ECS

A few months back I walked through the steps to build, tag and deploy Docker containers to AWS ECS. It’s been a while and I need to revisit the steps.

Although you can use the the AWS Console, using the aws cli works well complements the common steps with the docker cli.

The steps you need to connect and login the docker cli to aws are listed from the AWS ECS dashboard, from the Repositories tab. Press the ‘Push Commands’ button and it will show you the login command which looks like this:

aws ecr get-login --no-include-email --region us-east-1

and the output shows you a ‘docker login’ command – copy this and paste it to where you run your aws cli, to logon on aws.

Assuming you have a docker image already built (‘docker build -t yourimage .’), then you can tag it ready to push with the next command listed from the ‘Push Commands’ output:

docker tag yourimage:latest id-of-your-ecs-registry.dkr.ecr.us-east-1.amazonaws.com/yourimage:latest

Now push with:

docker push id-of-your-ecs-registry.dkr.ecr.us-east-1.amazonaws.com/yourimage:latest

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.