Using the EC2 container service

We just went over creating a Docker image for our application. Here, we saw how easy and fast it is to start a container using Docker. This is a very transformative experience compared to using only virtual machine technologies such as EC2. One possibility that we haven't explicitly mentioned so far is that you can start multiple containers with the same image. We can, for example, start our helloworld container five times, binding five different ports using the following command (adapt the ID based on the image ID you built. If needed, run Docker images to find its ID):

$ for p in {3001..3005}; do docker run -d -p ${p}:3000 4a6cb81d088d; done  

We can validate that everything is working using the ps and

Get Effective DevOps with AWS - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.