docker 主机操作系统和容器基础镜像操作系统是什么关系? [英] What is the relationship between the docker host OS and the container base image OS?

查看:206
本文介绍了docker 主机操作系统和容器基础镜像操作系统是什么关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我问的问题是否正确……但是,虽然我一直在阅读我可以接触到的所有 docker,但我发现我可以在 Ubuntu 12.04(例如)上安装 Docker,然后我可以安装 Fedora 容器或不同版本的 ubuntu 吗?(有一个例子,用户在容器中安装了busybox.)

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?

推荐答案

正如 BraveNewCurrency 所提到的,宿主操作系统和容器之间的唯一关系是内核.

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

这是 docker 和常规"虚拟机之间的主要区别之一,没有开销,一切都直接在主机内核中进行.

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.

这就是您只能在容器内运行基于 Linux 的发行版/二进制文件的原因.如果你想运行其他东西,也不是不可能,但你需要在容器内进行某种虚拟化(qemu、kvm 等)

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 管理作为文件系统表示的图像.您可以安装任何 linux 发行版或简单地放置二进制文件.

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.

这篇关于docker 主机操作系统和容器基础镜像操作系统是什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆