[英]How do I install os specific packages inside docker?
I am using ubuntu 15.10 and was trying to use docker to setup my node and mongo environments. 我正在使用ubuntu 15.10,并试图使用docker设置我的节点和mongo环境。 But since
lsb_release -a
command doesn't work inside docker I was not able to know the version of ubuntu docker image has. 但是由于
lsb_release -a
命令在lsb_release -a
内部不起作用,所以我不知道ubuntu docker映像的版本。 It was tagged as ubuntu:latest
. 它被标记为
ubuntu:latest
。 Also /etc/lsb-release
utility shows permission denied inside docker. 另外
/etc/lsb-release
实用程序还显示了docker内部拒绝的权限。
Is there a way to know which ubuntu version is present inside docker container because for installing mongo I need the name of version to add eg for 14.04 有没有办法知道docker容器中存在哪个ubuntu版本,因为要安装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
This should work 这应该工作
RELEASE=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d= -f2)
I just tried it on my ubuntu:latest docker image and got version 16.04 我只是在我的ubuntu:latest 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
And here is the output 这是输出
root@9c4c1e6313ce:/# RELEASE=$(cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -d= -f2)
root@9c4c1e6313ce:/# echo $RELEASE
16.04
You can use for ubuntu: 您可以使用ubuntu:
cat /etc/os-release
for alpine: 对于高山:
cat /etc/lsb-release
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.