Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Effective DevOps with AWS

You're reading from   Effective DevOps with AWS Implement continuous delivery and integration in the AWS environment

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781789539974
Length 384 pages
Edition 2nd Edition
Tools
Arrow right icon
Authors (3):
Arrow left icon
Giuseppe Borgese Giuseppe Borgese
Author Profile Icon Giuseppe Borgese
Giuseppe Borgese
Nathaniel Felsen Nathaniel Felsen
Author Profile Icon Nathaniel Felsen
Nathaniel Felsen
Yogesh Raheja Yogesh Raheja
Author Profile Icon Yogesh Raheja
Yogesh Raheja
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. The Cloud and DevOps Revolution FREE CHAPTER 2. Deploying Your First Web Application 3. Treating Your Infrastructure as Code 4. Infrastructure as Code with Terraform 5. Adding Continuous Integration and Continuous Deployment 6. Scaling Your Infrastructure 7. Running Containers in AWS 8. Hardening the Security of Your AWS Environment 9. Assessment 10. Other Books You May Enjoy

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 ourhelloworldcontainer five times, binding five different ports using the following command (adapt the ID based on the image ID you built. If needed, run Docker imagesto 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 curl commands:

$ docker ps
$ curl localhost:3005

The output of running the preceding command is as follows:

Note

Cleaning up containers: We can clean up everything by stopping and removing all containers with these two handy one-line commands:

  • $ docker stop $(docker...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime