Jul 16, 2018

Check which OS is running in Docker container

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.

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

Use the following instead:

  • lsb_release -sirc
  • cat /etc/os-release
And to cover CentOS too:

  • cat /etc/issue