How to check Ubuntu version inside a running Docker container?


I am trying to cross check my Ubuntu version in the running Docker container, for that I tried the following command

lsb_release -a

But looks like this is not present and errored out

root@5e4117f32d07:/# lsb_release -a
bash: lsb_release: command not found

Is there any command I can run to see the Ubuntu version?

1 Answer

5 years ago by

lsb_release doesn't work on all versions and may not be available with all distributions. You can check the version with the following command

cat /etc/*release

This outputs something like following

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
5 years ago by Karthik Divi