简体   繁体   中英

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:

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. 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. 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.

To verify that you are running Ubuntu 16:04, run cat /etc/os-release . It will provide you details about your OS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM