美文网首页
Check Linux Distributions

Check Linux Distributions

作者: 海胆阶段 | 来源:发表于2019-03-28 13:48 被阅读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
...

相关文章

网友评论

      本文标题:Check Linux Distributions

      本文链接:https://www.haomeiwen.com/subject/hpdqbqtx.html