tomol
tomol

Reputation: 763

Why don't docker use the host OS for all purposes

I have been reading up on docker, and I have understood that unlike VMs, docker uses the host OS's kernel. Why is there a requirement that the base image has to be an OS. Why can't docker use resources from the host OS (eg: filesystem) and use the isolation supported by the host OS ? (I am assuming that the host OS provides mechanism for isolation)

Upvotes: -1

Views: 229

Answers (1)

nishant80
nishant80

Reputation: 126

It depends on how you define an OS. Docker images are not full OS (unlike VMs). They do not have a kernel of their own. This means no specific kernel modules (device drivers for external hardware etc) are installed as the host OS already has them.

Images are simply filesystem clones of popular Linux distributions (the binaries in image are offcourse built for the target arch). There can be multiple reasons for it, I would try and put some here:

  • Near-VM like experience as users like to use their favorite Linux distribution
  • Pre-configured libraries based on distribution. Lets you run apps straight away with all distribution-based dependencies taken care.
  • Flexibility of running multiple distributions on same host (Great dev/test sandboxing!)
  • Greater isolation from other containers as each image is self sufficient and doesn't have to share a filesystem with others

Upvotes: 1

Related Questions