Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lsb_release of the host OS in a Docker

I want to get the Operating System that I'm running on inside a Docker.

This is what my docker-compose looks like and I'm inheriting from the python:2.7 image

 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

The lsb_release -d command returns Debian GNU/Linux 8.7 (n/a) instead of Ubuntu 14.04.5 LTS even though i'm mounting /usr/bin

like image 553
cjds Avatar asked Mar 10 '23 11:03

cjds


1 Answers

LSB is kind of deprecated/ignored on Debian-based distributions, and the file is not present in the Docker images of the most popular distros.

/etc/os-release is prefered now. You can see that this file is present on the Docker images of a lot of distributions (even Alpine), which is not the case with /etc/lsb-release.

like image 190
Ricardo Branco Avatar answered Mar 12 '23 01:03

Ricardo Branco