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.

  • I'd love to see how it is exactly that vbox can support non-linux guests better than KVM. – dyasny Apr 7 at 20:32
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.

  • A container usually includes multiple processes – 炸鱼薯条德里克 Apr 8 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 Apr 8 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.