Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker is not VM , why container need base image OS ? [closed]

It is said that docker is not a VM and containers directly run on the host.

But why do containers need a base image OS ?

If process in containers run on the base image OS , what's the difference between a VM and docker(only the base image OS can be re-used and kept read-only?)

And why does it boot faster than a VM?

What makes up a base image OS ? kernel , rootfs or both?

like image 896
cola Avatar asked Dec 29 '13 09:12

cola


People also ask

Can a Docker container be created without a base OS image?

No its not like that. To create any docker image using DockerFile, You need to start with a base docker image. That base docker image can be anything, Like an empty image as well, In the docker file in your example the FROM section says ubuntu, it means its assuming ubuntu as the base image.

Does a Docker image need an OS?

The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.

Why does Docker need a base image?

A base image is the image that is used to create all of your container images. Your base image can be an official Docker image, such as Centos, or you can modify an official Docker image to suit your needs, or you can create your own base image from scratch.

Why do Docker containers need an OS?

Docker does not has an OS in its containers. In simple terms, a docker container image just has a kind of filesystem snapshot of the linux-image the container image is dependent on.


1 Answers

You might want to refer to this blog post: http://www.activestate.com/blog/2013/06/solomon-hykes-explains-docker

Simply put, Docker does a process isolation leveraging LXC (a kind of lightweight virtualisation built into Linux Kernel). The basic difference between LXC and VMs is that with LXC there is only one instance of Linux Kernel running. The base image OS is used for filesystem, binaries, etc.

like image 171
ondrasek Avatar answered Sep 22 '22 10:09

ondrasek