ubuntu - 正确安装了 Dockerfile 依赖项,但生成的图像没有它

标签 ubuntu docker dockerfile

我有以下 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/

相关文章:

command-line - 在 Ubuntu 中模拟鼠标移动

docker - 无法在docker-swarm上 curl traefik仪表板

docker - 无法从 gitlab CI 拉取或推送到个人注册表

Dockerfile:我的 EXPOSE 位置是否正确?

c# - docker 无法从 wwwroot 中找到文件

shell - 当 splunk 第一次在 docker 容器中启动时,是否可以跳过许可协议(protocol)页面?

windows - 从Windows系统在docker build上启动基本bash脚本

Ubuntu 中不支持 SQLCipher 的 SQLite 浏览器

android - 如何在ubuntu服务器上安装android SDK

ubuntu - 先前的存储驱动程序 "aufs"失败 : driver not supported Error starting daemon: error initializing graphdriver: driver not supported