$(uname -a) returning the same in docker host or any docker container

一笑奈何 提交于 2019-11-30 06:55:51

问题


Why $(uname -a) returns the same Linux kernel than the host machine inside a docker container?

uname -a
#=> Linux leo 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

docker run -ti --rm ubuntu:vivid-20150611 uname -a
#=> Linux 147c3aff216b 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Even though my host machine is Ubuntu 14.04 (trusty) while the container is Ubuntu 15.04 (vivid) and should have kernel 3.19


回答1:


Docker uses the host operating system kernel, there is no custom or additional kernel inside the container. All containers running on the machine are sharing this "host" kernel.

See for more information this question on SuperUser.




回答2:


  • cat /etc/os-release, or
  • cat /etc/issue for CentOS

See https://serverfault.com/a/805390/161568.



来源:https://stackoverflow.com/questions/31012297/uname-a-returning-the-same-in-docker-host-or-any-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!