Docker Community Forums

Share and learn in the Docker community.

What choose Docker over just running VM in real life scenario?

(Artisticcheese) #1


I’m having hard time sell idea of using docker in production environment as opposed just running full blown VMs instead of it. I understand advantages for development/deployment/consistency point of view. But what docker essentially does in sense is virtualizing OS layer but in production environment when primary driving factor is not OS perfomance but application itself why would you choose containers instead of running on VM? Say you need three 2 core servers for your webapplications so your application can stay below 60% CPU utilization. None of that CPU is used by OS but all user mode, how does container methodology fit into this picture?
Do you deploy 2 container hosts with 4 CPUs in each of them and still run 3 containers inside them? What exactly the selling point here?

(Michael Friis) #2

Thanks for posting!

I recommend checking out this answer:

Because containers virtualize the OS instead of the hardware (as VMs do), they’re much more efficient and give you better density than with VMs.

(Artisticcheese) #3

It makes only sense for any workload which is not maxing out any underlying resources (say CPU). If you have CPU bound applications then what exactly docker provides? What sense does it make to run 2 containers on same container host if I have a CPU bound application?

(Michael Friis) #4

Even for CPU-bound apps, there’s overhead: Using VMs, you’d be running 3 full operating systems (in addition to the two apps) each doing their own logging, memory management, etc. With containers, there’s only one operating system kernel in operating which means less overhead in terms of both diskspace, memory use but also CPU time taken up by kernel tasks.

(Artisticcheese) #5

So you are saying running 2 containers on 1 container host will provide better perfomance then dedicating host to this specific application? Say I have web server application which takes 80% CPU on 2 vCPU box. I have this application load balanced accross 4 VMs. If I use containers I will say still run 4 web applications accross less VMs due to some savings in OS related tasks?
I can see how this entire thing can work if you have underutilized operating systems (like with low CPU overhead) etc (the same thing virtualization did to hardware) but still have time understanding benefits for high CPU based applications where additional layer of virtualization of OS can only add to overhead.