如何在Docker中安装特定于OS的软件包?

我正在使用Ubuntu 15.10,并试图使用docker设置我的节点和mongo环境。 但是由于lsb_release -a命令在lsb_release -a不起作用,所以我无法知道ubuntu docker映像的版本。 它被标记为ubuntu:latest 。 另外/etc/lsb-release实用程序显示了在docker中拒绝的权限。

有没有办法知道哪个Ubuntu版本存在docker集装箱内,因为安装mongo我需要版本的名称,例如为14.04

 echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list 

这应该工作

 RELEASE=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d= -f2) 

我只是尝试在我的Ubuntu的:最新的docker形象,并得到了16.04版本

 $ docker run -it ubuntu:latest /bin/bash Unable to find image 'ubuntu:latest' locally latest: Pulling from library/ubuntu 6d28225f8d96: Pull complete 166102ec41af: Pull complete d09bfba2bd6a: Pull complete c80dad39a6c0: Pull complete a3ed95caeb02: Pull complete Digest: sha256:5718d664299eb1db14d87db7bfa6945b28879a67b74f36da3e34f5914866b71c Status: Downloaded newer image for ubuntu:latest 

这里是输出

 root@9c4c1e6313ce:/# RELEASE=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d= -f2) root@9c4c1e6313ce:/# echo $RELEASE 16.04 

你可以使用Ubuntu的:

 cat /etc/os-release 

对于高山:

 cat /etc/lsb-release