[英]Running docker container with ubuntu:16.04 actually runs ubuntu 18.04
I was trying to run a docker container with ubuntu:16.04 (on a ubuntu 18.04 machine) with the following command:我试图使用以下命令运行带有 ubuntu:16.04(在 ubuntu 18.04 机器上)的 docker 容器:
docker run -i -t --name ubuntu ubuntu:16.04 /bin/bash
Running this command attaches me to a container.运行此命令会将我附加到一个容器。 But when I check the kernel information with
uname -a
, it shows that the current kernel is Ubuntu 18.04.但是当我用
uname -a
检查内核信息时,它显示当前内核是 Ubuntu 18.04。 Following is the result I get:以下是我得到的结果:
Linux 1ac6c3456e2a 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
What could be the cause?可能是什么原因?
Docker uses host OS kernel, there is no custom or additional kernel inside container.
Docker 使用主机操作系统内核,容器内部没有自定义或附加内核。 All containers which run on a machine are sharing this "host" kernel.
在一台机器上运行的所有容器都共享这个“主机”内核。
Please read this for more detail.请阅读本文了解更多详情。
So #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 in the output of uname -a
is actually the Kernel version of the host machine.所以#32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020在
uname -a
的输出中实际上是主机的内核版本。
To verify that you are running Ubuntu 16:04, run cat /etc/os-release
.要验证您正在运行 Ubuntu 16:04,请运行
cat /etc/os-release
。 It will provide you details about your OS.它将为您提供有关操作系统的详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.