8

I've read that Containerization is cheaper than virtualization; I know that containerization uses less resources than virtualization since there's only one OS involved and no virtualized hardware.

But do I need a CPU that supports virtualization to run containerization such as Docker, or since it runs an app using the OS's libraries in a container, can I just run it on a CPU without virtualization?

4
  • 1
    blog.circleci.com/its-the-future Commented Jun 10, 2015 at 16:36
  • All modern CPU supports some form of virtualization, the most common one is virtual memory is required by all modern OS to implement the humble "process". All modern CPU also have distinction between kernel and user mode code. Running virtualization is just a matter of the kernel not terminating the process if a process tries to execute privileged instructions, but instead it handles the fault by emulating what would happen in real hardware.
    – Lie Ryan
    Commented Jun 10, 2015 at 17:05
  • @LieRyan unfortunately on x86 it's not that simple. Kernel mode on plain x86 was different enough from user mode that trapping stuff is not enough dyanmic recompilation had to be used to run virtualisation. As virtualisation took off Intel and AMD added special CPU modes for virtualisation to avoid the need for dynamic recompilation. This is what is meant in the x86 world when we talk about a "CPU that supports virtualisation". Commented Jul 10, 2016 at 2:59
  • @PeterGreen: dynamic recompilation is the virtual machine manager's feature, not a CPU feature. VT-x, AMD-v, and other virtualization features are generally not needed for basic virtualization, they just reduce the virtualization overhead. In any case, most x86 CPU in the last five years or so do support VT-x or AMD-v, though the feature sometimes need to be enabled in BIOS.
    – Lie Ryan
    Commented Jul 10, 2016 at 12:20

1 Answer 1

10

But do I need a CPU that supports virtualization to run containerization such as Docker, or since it runs an app using the OS's libraries in a container, can I just run it on a CPU without virtualization?

No, Docker (and other container solutions like LXC) do not require any special hardware support. They are effectively an enhanced version of chroot that uses kernel features (primarily namespaces) to isolate process trees from your host and from each other.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .