128

I'm not certain that I'm asking the right question... but while I have been reading everything docker that I can get my hands on I see that I can install Docker on Ubuntu 12.04 (for example) and then I can install a Fedora container or a different version of ubuntu? (there is an example where the user installed busybox in the container.)

And of course I could be completely wrong.

But it would be my expectation that there was a ephemeral connection between the base system and the container.

restated: what is the relationship between the host OS and the container base image's OS?

4

3 回答 3

103

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.

于 2013-09-17T21:11:11.347 回答
25

从字面上看,它们唯一的共同点就是内核。他们的整个世界(文件系统)都在 docker 容器中。

于 2013-09-15T00:32:40.387 回答
1

还有一个考虑 - 即使两个内核相同,如果主机操作系统不支持 Docker,例如 RHEL 6,就会出现问题:https ://access.redhat.com/solutions/1378023

因此,即使镜像是 Linux 镜像,您也无法在 RHEL 6 上启动容器。

于 2019-10-11T01:29:50.490 回答