Check Linux Distributions
2019-03-28 本文已影响0人
海胆阶段
I encounter a problem that check which OS is running in my docker container, or extend it as how to check which OS am I using?
cat /etc/os-release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.5 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
...
hostnamectl
Static hostname: example.com
Icon name: computer-vm
Chassis: vm
Machine ID: e57cfe9136e9430587366e04f14195e1
Boot ID: 6ebe05de8b7f43c0bfa36d2c62b702de
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.5 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.5:GA:server
Kernel: Linux 3.10.0-862.14.4.el7.x86_64
Architecture: x86-64
For docker image, you can use docker image inspect
command:
docker image inspect <image name>:<tag> | grep -i "base image"
"org.label-schema.schema-version": "= 1.0
org.label-schema.name=CentOS Base Image
org.label-schema.vendor=CentOS
...