Docker中主机操作系统的lsb_release

cjd*_*jds 2 ubuntu docker docker-compose

我想获得我在Docker中运行的操作系统.

这就是我的docker-compose样子,我将继承python:2.7图像

 version: '2'
 services:
   robot-configuration-interface:
     build: '.'
     restart: always
     network_mode: 'host'
     ports:
       - 8000:80
     environment:
       - REDIS_HOST=localhost
       - DEBUG=true
     volumes:
       - ~/logs/fetchcore-server:/var/log/supervisor
       - /var/run/docker.sock:/var/run/docker.sock
       - /opt/ros/indigo:/opt/ros/indigo
       - /etc/environment:/etc/environment
       - /etc/NetworkManager/system-connections/:/etc/NetworkManager/system-connections/
       - /lib:/lib
       - /usr/lib/:/usr/lib
       - /usr/bin/:/usr/bin/
       - /var/run/:/var/run/
     privileged: true
     user: root
Run Code Online (Sandbox Code Playgroud)

lsb_release -d命令返回Debian GNU/Linux 8.7(n/a)而不是Ubuntu 14.04.5 LTS,即使我正在安装/usr/bin

Ric*_*nco 7

LSB在基于Debian的发行版中被弃用/忽略,并且该文件不存在于最受欢迎的发行版的Docker镜像中.

/ etc/os-release现在更喜欢.你可以看到这个文件出现在很多发行版(甚至是Alpine)的Docker镜像上,而/ etc/lsb-release却不是这样.