Push newly created Docker Image to Docker Repository (Amazon ECR)

Push newly created Docker Image to Docker Repository (Amazon ECR)

We will create a remote private repository using Amazon ECR (Elastic Container Registry)

But before that, you need to install AWS CLI on Windows and configure it with the credentials.

Amazon ECR Docker Registry: https://aws.amazon.com/ecr/

● Installing AWS CLI Linux:

Installing AWS CLI on MacOS:

Installing AWS CLI on Windows:

Configuring the AWS CLI:

Let us Begin:

Step 1: Create a private repository. (my-app)

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Click on the my-app checkbox and then click on View Push commands.

No alt text provided for this image

Now once you reach here you will execute this command one by one:

1. Authentication.

No alt text provided for this image

2. Build your application using the docker built command.

No alt text provided for this image
No alt text provided for this image

Then Rename the image using the docker tag command:

No alt text provided for this image

And now push the renamed Docker image of your application to the repository:

No alt text provided for this image

In a similar way, you can follow the above steps and build a new version artifact after refactoring the application to the Remote Repository.

No alt text provided for this image

Now Let’s see how to Deploy the Application in different Environments:

For example, here let’s imagine we want to Deploy the Docker image of our Application (my-app:1.0) from Private Repository (Amazon ECR) and also the MongoDB and Mongo Express UI image from Docker Hub to our Development or Testing server.

First, we will edit our docker-compose.yaml file and add the Docker image that was built using the docker build command.

No alt text provided for this image

Now we need to copy this .yaml file to the Development server where we want to execute Docker compose command to make all these services up and running.

Docker-compose.yaml file

No alt text provided for this image

And after that by typing the docker-compose command we have all the Services (container up and running) from just one docker image and compose file. Easy right?

No alt text provided for this image

In this way, we completed the entire workflow:

No alt text provided for this image

1. We developed the JavaScript Application with Docker containers.

2.?Then we built this app into a Docker Image (Like CI would do using Jenkins)

3.?Then we pushed the Image to Private Repository.

4.?And lastly, we pull the images from a private repository.



要查看或添加评论,请登录

社区洞察

其他会员也浏览了