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)
Click on the my-app checkbox and then click on View Push commands.
Now once you reach here you will execute this command one by one:
1. Authentication.
2. Build your application using the docker built command.
领英推荐
Then Rename the image using the docker tag command:
And now push the renamed Docker image of your application to the repository:
In a similar way, you can follow the above steps and build a new version artifact after refactoring the application to the Remote Repository.
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.
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
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?
In this way, we completed the entire workflow:
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.