There seems to be a growing trend of developers setting up multiple Docker containers inside of their AWS EC2 instances. This seems counterintuitive to me. Why put a virtual machine inside another virtual machine? Why not just use smaller EC2 instances (ie make the instance the same size as your container and then not use Docker at all)? One argument I've heard is that Docker containers make it easy to bring your development environment exactly as-is to prod. Can't the same be done with Amazon Machine Images (AMIs)? Is there some sort of marginal cost savings? Is it so that developers can be cloud-agnostic and avoid vendor lock in? I understand the benefits of Docker on physical hardware, just not on EC2.
Asked
Active
Viewed 110 times
1
-
"Why put a virtual machine inside another virtual machine?" -> A docker container is a "container", not a VM; they might look similar, but are very different technologies, with different benefits and disadvantages; "Why not just use smaller EC2 instances (ie make the instance the same size as your container and then not use Docker at all)?" -> sometimes you might need so little resources that even the smallest instance (t2.nano as of today) would be "too much"; "Can't the same be done with Amazon Machine Images (AMIs)?" -> not really, since you cannot run AMIs on a non-AWS test environmet. – Bruno Reis Jun 30 '16 at 06:32
2 Answers
1
Docker containers inside of their AWS EC2 instances. This seems counterintuitive to me. Why put a virtual machine inside another virtual machine?
Err... a docker container is not a VM. It is a way to isolate part of the resources (filesystem, CPU, memory) of your host (here an EC2 VM).
AMI (Amazon Machine Images) is just one of EC2 resources

VonC
- 1,262,500
- 529
- 4,410
- 5,250
1
The main advantage of Docker related to your question is the concept of images. These are light-weight and easier to configure than AMIs. Also, note that Docker is simple because it runs on a VM (in this case EC2).
More info here - How is Docker different from a normal virtual machine?