Verify the version of ubuntu running in a Docker container Verify the version of ubuntu running in a Docker container docker docker

Verify the version of ubuntu running in a Docker container


The uname command is pulling specs from the kernel running on the host. If I enter a Ubuntu container on my Debian host, the uname will answer with a Debian build of the kernel.

To know the version of Ubuntu you are running, do a

$ cat /etc/lsb-releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=16.04DISTRIB_CODENAME=xenialDISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"

It's simple variables that are shell script friendly, so you can run

#!/bin/shif [ ! -f /etc/lsb-release ]; then  echo "lsb-release missing, unlikely to be a Ubuntu system"  exit 1fi. /etc/lsb-releaseif [ "$DISTRIB_ID" != "Ubuntu" -o "$DISTRIB_RELEASE" != "16.04" ]; then  echo "Linux install doesn't appear to be Ubuntu 16.04"  exit 1fi...


Try this

cat /etc/os-release

It will return like this

NAME="Ubuntu"VERSION="16.04.3 LTS (Xenial Xerus)"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 16.04.3 LTS"VERSION_ID="16.04"HOME_URL="http://www.ubuntu.com/"SUPPORT_URL="http://help.ubuntu.com/"BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"VERSION_CODENAME=xenialUBUNTU_CODENAME=xenial