How To: Publish a Docker Image from a local machine to AWS Cloud

Sam Joseph
Slamtrade
Published in
2 min readDec 19, 2018

Step 1: Install the AWS Command Interface on Linux using the following link.

Step 2: After installing the AWS CLI in Linux, configure the AWS from your terminal using the command.

$ aws configure

To get the AWS Access Key ID and Secret Access Key, go to your AWS console and click My Security Credentials -> Access keys (access key ID and secret access key) -> Create New Access Key. Give your region name and give the default output format empty and type enter which will set the output format to default.

Step 3: Create a repository in AWS ECR

Click on the repository and select View push commands where you will see below commands. Retrieve the login command to authenticate your Docker client to your registry.

From AWS CLI:

$(aws ecr get-login — no-include-email — region us-east-2)

Copy the output from the above and paste again in the terminal and press ‘Enter’. On success ‘Login Succeeded’ message will be shown.

Step 4: Build your Docker image using the following command. For information on building a Docker file from scratch see the instructions here . You can skip this step if your image is already built:

$ docker build -t akkahttp-quickstart .

After the build completes, tag your image so you can push the image to this repository:

$ docker tag akkahttp-quickstart:latest 536135142870.dkr.ecr.us-east-2.amazonaws.com/akkahttp-quickstart:latest

Step 5: Run the following command to push this image to your newly created AWS repository:

$ docker push 536135142870.dkr.ecr.us-east-2.amazonaws.com/akkahttp-quickstart:latest

On success, it will be seen in the repo as below.

published by slamtrade.com

--

--