I know that docker containers do not run their own kernel but share one with the host unlike a VM which runs it's own kernel but what is the practical differences between a debian docker image and a vm with debian installed?

Is there anything that can be done inside one but not the other or are they functionally the same so anything that runs on a real debian install will work as well inside of a docker debian container?

Also does the host OS change things? If I run a debian container on a CentOS system will it work different to a debian container on a debian system?


The main practicals differences between Docker container and VM:

  1. Docker image is just base image from original system (debootstap helps to get this base image) and of cause it may (or not) contains kernel, initrd ... But the kernel, initrd ... are not make sense instead of researching, development, other packages dependencies. So, if they not necessary, then they can be safely removed.

  2. Docker containers starts in different namespace that hide real system processes, network connections ... from container impact. In simple, you can't to kill real system process from Docker container, but you can see Docker container process as ordinary process from real system and do anything with it. VM organised more difficult instead of namespace concept: all VMs starts as huge applications which controlled by VM software (VirtualBox, VMware ... ). VM software traps all system calls from this application and pass it to real hardware. Therefore they are slower than container concept.

  3. Docker containers provide support environment that needed to run some application (specific libraries versions, software components ...), but not kernel. Therefore, if your application uses new kernel features, they will not be worked.

  4. Docker containers often doesn't contain full system image, because main target for Docker concept is share applications. The main target of VM is share Operation Systems.

There is no difference about real system that starts specific Docker image (except cases where your application depends on specific kernel).

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.