0

When would you choose to use a Linux virtual machine instead of a docker container?

Is there something which a docker container can't be used for while a Linux virtual machine can?

Is it correct that if you require a Linux kernel version different from the host's, you can only use a virtual machine not a docker container? (I said so because I heard that a docker container use the same kernel as the host Linux.)

In particular, Docker and VirtualBox seem to put KVM/QEMU at disadvantage, because Docker can do what KVM/QEMU can and VirtualBox supports non-Linux guest better than KVM/QEMU.

Thanks.

1
  • I'd love to see how it is exactly that vbox can support non-linux guests better than KVM.
    – dyasny
    Commented Apr 7, 2019 at 20:32

1 Answer 1

2

Is there something which a docker container can't be used for while a Linux virtual machine can?

Sure. A container is just a process: it can't behave like a different processor, and it can't boot a different kernel, and it can't run another operating system. A virtual machine can do all of those things. Because the entire state of a virtual machine is maintained inside the hypervisor, it can be paued/unpaused, migrated to other physical hosts, and similar actions that are difficult or impossible with current container technology.

Is it correct that if you require a Linux kernel version different from the host's, you can only use a virtual machine not a docker container?

That's correct. Containers are just processes running on the host kernel, just like the non-containerized processes on the host.

In particular, Docker and VirtualBox seem to put KVM/QEMU at disadvantage.

They have different use cases. Depending on what y ou want to do, either technology may end up being the better choice.

2
  • A container usually includes multiple processes Commented Apr 8, 2019 at 13:22
  • Sure. But it has a single entrypoint; that process may indeed spawn children, but the point is that the container itself is defined by the parent process, which is just like any other process on your system.
    – larsks
    Commented Apr 8, 2019 at 13:38

You must log in to answer this question.

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