0

What is the difference between running a Docker container with Debian (eg. https://hub.docker.com/_/debian/) and then running a virtual machine with Debian? And why is it still an advantage if any?

I'm curious to know the details since the concept of Docker is to not include the OS layer and therefore make it lightweight...! But how come there is a docker image with the Debian operating system (!) when containers do not run an operating system?! How is it that I can still have all the Linux OS features in a Linux container (bash, filesystem, file structure, package manager, cron jobs etc etc) if I don't have that OS?!

Note: I'm using Docker Desktop for Windows.

1 Answer 1

2

With an VM you have a complete machine with all the overhead like filesystem, bash.... With Docker, you use all of that from the "host". Only what is really different is sort of duplicated.

makes sense?

here is an picture: docker vs VM

To make it a bit clearer:

In the docker container are only the extra bins/libs needed for that particular application.

Everything else is provided by the host-os.

That makes the up and down of the app much faster and the overall systemload is much less, since you only have one os running.

With an VM, on the other hand, you have a whole os running. Most of that is not needed.

4
  • I understand it conceptually - maybe it's just that I have a hard time understanding why I have all the OS features in a Linux container that I normally have in a VM (bash, filesystem, file structure, cron jobs etc etc) - or is my confusion simply because I'm using Docker Desktop for Windows which runs a Linux VM for all my containers and that is the common OS for all of them? Jun 3, 2021 at 17:03
  • For docker: There is no need* to run a VM when running on a linux operating system.
    – Erich
    Jun 4, 2021 at 9:36
  • *Should you run outside of a VM is a security question. Likewise, should I run with this pair of scissors is a health question.
    – Erich
    Jun 4, 2021 at 9:36
  • @TheStoryCoder: probably. Docker is using Linux underneath, that's why, yes.
    – David
    Jun 4, 2021 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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