我有以下 Dockerfile:
FROM ubuntu:trusty
RUN apt-get update
RUN apt-get -y install python-software-properties
运行它:
sudo docker build -t my_step1 .
我看到底线是:
Successfully built b7f1e789d8e8
这看起来很有希望。但是,尝试它我得到:
avidane$ docker run -it my_step1 bash
root@e6756cdd93bd:/# add-apt-repository
bash: add-apt-repository: command not found
我错过了什么?
最佳答案
这个问题是 Ubuntu 和 Debian 特有的,所以它可能属于 askubuntu.com,其中 it's been asked already .
在所有基于 Debian 的 Ubuntu 版本中 杰西 ,你会发现add-apt-repository
包装内python-software-common
:
sudo apt-get install python-software-common
在所有基于 Debian 的 Ubuntu 版本中 气喘吁吁 ,你会发现
add-apt-repository
包装内python-software-properties
:sudo apt-get install python-software-properties
提示:输入
cat /etc/debian_version
在终端中找出您当前的 Ubuntu 发行版基于哪个 Debian 版本。所有 jessie/wheezy Ubuntu 版本:
15.10 wily jessie / sid
15.04 vivid jessie / sid
14.10 utopic jessie / sid
14.04 trusty jessie / sid <-- the OP is using trusty/jessie
13.10 saucy wheezy / sid
13.04 raring wheezy / sid
12.10 quantal wheezy / sid
12.04 precise wheezy / sid
11.10 oneiric wheezy / sid
您可以在此处查找包中的包和特定文件:
http://packages.ubuntu.com/
正在搜索文件
add-apt-repository
在 Ubuntu 中值得信赖:http://packages.ubuntu.com/search?searchon=contents&keywords=add-apt-repository&mode=exactfilename&suite=trusty&arch=any
File Packages
/usr/bin/add-apt-repository software-properties-common
关于ubuntu - 正确安装了 Dockerfile 依赖项,但生成的图像没有它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41320384/