Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the relationship between the docker host OS and the container base image OS?

Tags:

docker

People also ask

What is the relationship between image and container in Docker?

Images can exist without containers, whereas a container needs to run an image to exist. Therefore, containers are dependent on images and use them to construct a run-time environment and run an application. The two concepts exist as essential components (or rather phases) in the process of running a Docker container.

Can the container OS be different from host OS?

A container uses the kernel of the host OS and has operating system dependencies. Therefore, containers can differ from the underlying OS by dependency, but not by type. The host's kernel limits the use of other operating systems. Containers still do not offer the same security and stability that VMs can.

What is a host or container host in Docker?

The docker host is the base traditional OS server where the OS and processes are running in normal (non-container) mode. So the OS and processes you start by actually powering on and booting a server (or VM) are the docker host. The processes that start within containers via docker commands are your containers.

What does a container base image OS contains?

Container OS: Also called the Base OS. The base OS refers to an image that contains an operating system such as Ubuntu, CentOS, or windowsservercore. Typically, you would build your own image on top of a Base OS image so that you can take utilize parts of the OS.


As mentioned by BraveNewCurrency, the only relationship between the host OS and the container is the Kernel.

It is one of the main difference between docker and 'regular' virtual machines, there is no overhead, everything takes place directly within the host's kernel.

This is why you can run only Linux based distribution/binaries within the container. If you want to run something else, it is not impossible, but you would need some kind of virtualization within the container (qemu, kvm, etc.)

Docker manage images that are the file system representation. You can install any linux distribution or simply put binaries.

Indeed, for the convenience of the example, we often rely on the base images, but you could also create your image without any of the distribution libraries/binaries. That way you would have a really tiny yet functional container.

One more point regarding the distributions: as the kernel is still the kernel of the host, you will not have any specific kernel module/patches provided by the distribution.


Literally, the only thing they have in common is the kernel. Their whole world (file system) is in the docker container.


There is another consideration - even if the both kernels are the same, there is a problem if the host OS does not support Docker, like RHEL 6: https://access.redhat.com/solutions/1378023

So you won't be able to spin up a container on RHEL 6, even if the image is a Linux one.