0

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)

tomol
  • 755
  • 1
  • 6
  • 12
  • 1
    One of the strengths of docker is that you can, from a Ubuntu host (or anything else), run a Centos/Debian/fedora/busybox... based container – user2915097 Apr 02 '15 at 13:17

1 Answers1

1

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
nishant80
  • 136
  • 1
  • 9
  • 1
    Note that you could have an image with **no** OS, just a binary (like the swarm image or others). The *Os* part of the image is there for dependencies that your application could have (to a library, a binary, etc..) – Vincent Demeester May 25 '15 at 09:49