visit
nano DockerFile
FROM amazonlinux
RUN yum -y update
RUN yum -y install httpd
RUN echo 'Hello World from ECR! This is version 1' > /var/www/html/index.html
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
EXPOSE 80
Next, let's compile the image and run the command:
docker build -t hello-world-app .
As we can see, you have two new images created. This completes the first step.
Here we need to enter the name of the repository and create a private one. I want to note that Amazon has restrictions on private, public repositories and be careful not to exceed the limit. Next, we will go to the repository, and as we see that it is impossible to upload our image to the repository. Moreover, we do not even have a button. Next, click the View push commands button and see Amazon's commands (Image 4).
These commands are for the old version of the CLI, but I will show you how to use a much simpler command. Next, we need to rename our image to the name that AWS suggests to us. Let's copy this freak name (Image 5).
Next, go to our terminal and run the command:
docker tag hello-world-app:latest 977701475595.dkr.ecr.us-east-1.amazonaws.com/app1:v1
Next, as I described earlier, we will run a command to send our image to the repository. To do this, run the aws configure
command and enter the Access key
id and Secret access key
. Next, we will install the region in which you have deployed the repository (Image 7).
To push the image, you need to log in by entering the command:
aws ecr get-login --no-include-email --region us-east-1
Using the command from View push command:
docker push 977701475595.dkr.ecr.us-east-1.amazonaws.com/app1:v1