Docker如何处理不同的内核版本? [英] How does Docker handle different kernel versions?

查看:786
本文介绍了Docker如何处理不同的内核版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我为使用版本10内核的操作系统制作映像。如果我在运行版本9内核的主机操作系统上为该映像运行容器,那么Doc​​ker会表现出什么行为?那么版本11呢?

Let's say that I make an image for an OS that uses a kernel of version 10. What behavior does Docker exhibit if I run a container for that image on a host OS running a kernel of version 9? What about version 11?

版本的向后兼容性重要吗?我出于好奇而问,因为该文档仅讨论最低Linux内核版本等。听起来,主机运行的内核版本超过该最低数量无关紧要。这是真的?

Does the backward compatibility of the versions matter? I'm asking out of curiosity because the documentation only talks about "minimum Linux kernel version", etc. This sounds like it doesn't matter what kernel version the host is running beyond that minimum. Is this true? Are there caveats?

推荐答案


比方说,我为使用内核的OS制作了映像版本10的版本。

Let's say that I make an image for an OS that uses a kernel of version 10.

我认为这有点误解,除非您正在谈论依赖于较新内核功能的特定软件。在您的Docker映像中,这应该非常少见。一般来说,Docker映像只是一个自定义文件/目录结构,通过 FROM RUN 指令分层组装或更多 Dockerfiles ,其中包含一些元数据,例如要打开的端口或在容器启动时执行的文件。真的就是全部。 Docker的基本原理与经典 chroot监狱非常相似,

I think this is a bit of a misconception, unless you are talking about specific software that relies on newer kernel features inside your Docker image, which should be pretty rare. Generally speaking a Docker image is just a custom file/directory structure, assembled in layers via FROM and RUN instructions in one or more Dockerfiles, with a bit of meta data like what ports to open or which file to execute on container start. That's really all there is to it. The basic principle of Docker is very much like a classic chroot jail, only a bit more modern and with some candy on top.


如果在运行版本内核的主机操作系统上为该映像运行容器,Docker会表现出什么行为9?版本11呢?

What behavior does Docker exhibit if I run a container for that image on a host OS running a kernel of version 9? What about version 11?

如果内核可以运行Docker守护程序,那么它应该可以运行任何映像。

If the kernel can run the Docker daemon it should be able to run any image.


有警告吗?

Are there caveats?

如上所述,Docker镜像包含依赖于最新内核功能的软件的软件将无法在不具有这些功能的内核上运行,这不足为奇。 Docker不会阻止您在较旧的内核上运行这样的映像,因为它根本不在乎映像中的内容,也不知道用来创建映像的内核是什么。

As noted above, Docker images that include software which relies on bleeding edge kernel features will not work on kernels that do not have those features, which should be no surprise. Docker will not stop you from running such an image on an older kernel as it simply does not care whats inside an image, nor does it know what kernel was used to create the image.

我唯一想到的另一件事是针对特定的CPU(例如Intel或Amd)进行积极的优化手动编译软件。这样的映像将在具有不同cpu的主机上失败。

The only other thing I can think of is compiling software manually with aggressive optimizations for a specific cpu like Intel or Amd. Such images will fail on hosts with a different cpu.

这篇关于Docker如何处理不同的内核版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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