Base OS image on containers

What purpose does the base OS image serve with docker if containers dont have guest OS?

Understand the lecture mentions the user space v kernel space and containers share the host OS kernel.

So can I have a container without a base OS image?

The “No OS” container demonstrates that you do not NEED a base OS to run a container in Linux. You can create a Docker file that has a base image of scratch and then runs a binary that uses the kernel directly.

Hi sundarramanathan,

Since all Linux distributions run the same (yup, it’s a bit simplified) Linux kernel and differ only in userland software, it’s pretty easy to simulate a different distribution environment - by just installing that userland software and pretending it’s another distribution. Being specific, installing CentOS container inside Ubuntu OS will mean that you will get the userland from CentOS, while still running the same kernel, not even another kernel instance.

So lightweight virtualization is like having isolated compartments within same OS. Au contraire real virtualization is having another full-fledged OS inside host OS. That’s why docker cannot run FreeBSD or Windows inside Linux.

If that would be easier, you can think docker is kind of very sophisticated and advanced chroot environment.