Docker:无法纠正问题,您持有损坏的软件包

标签 docker debian dockerfile docker-build

我有 Dockerfile,我已经使用了很多次,没有出现任何问题。现在我需要向其中添加一些包(ssmtp 和 sendmail),当我添加它们时,构建失败并显示:

Sending build context to Docker daemon 645.3 MB
Sending build context to Docker daemon 
Step 0 : FROM debian:jessie
 ---> 736e5442e772
Step 1 : MAINTAINER Larry Martell <larry.martell@foo.com>
 ---> Using cache
 ---> bd272aa26940
Step 2 : ENV HOME /opt/django/CAPgraph/
 ---> Using cache
 ---> 1c540ed91808
Step 3 : RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list
 ---> Using cache
 ---> 8788d48e625d
Step 4 : RUN (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf ssmtp sendmail)
 ---> Running in 8986bca93fdb
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [436 kB]
Get:3 http://http.debian.net jessie-backports InRelease [166 kB]
Get:4 http://httpredir.debian.org jessie-updates InRelease [145 kB]
Get:5 http://http.debian.net jessie-backports/main amd64 Packages [1031 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Ign http://httpredir.debian.org jessie InRelease
Get:7 http://httpredir.debian.org jessie Release.gpg [2373 B]
Get:8 http://httpredir.debian.org jessie Release [148 kB]
Get:9 http://httpredir.debian.org jessie/main amd64 Packages [9049 kB]
Fetched 11.1 MB in 9s (1211 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sendmail : Depends: sendmail-bin but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf ssmtp sendmail)' returned a non-zero code: 100

如果我将这些软件包添加到列表中,我就会提示其他软件包。此“持有损坏的包裹”消息是什么意思以及如何修复它?

这是我的 Dockerfile 的第一部分:

FROM debian:jessie ENV HOME /opt/django/CAPgraph/ 
RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list 
RUN (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf sendmail ssmtp)

我尝试添加 sendmail-bin,但失败了:

The following packages have unmet dependencies:
 sendmail-bin : Conflicts: mail-transport-agent
 ssmtp : Conflicts: mail-transport-agent
E: Unable to correct problems, you have held broken packages.

然后我添加了邮件传输代理,但失败了:

Package mail-transport-agent is a virtual package provided by:
  opensmtpd 5.7.3p2-1~bpo8+1
  ssmtp 2.64-8
  sendmail-bin 8.14.4-8+deb8u1
  qmail-run 2.0.2+nmu1
  postfix 2.11.3-1
  nullmailer 1:1.13-1+deb8u1
  msmtp-mta 1.4.32-2
  masqmail 0.2.30-1
  lsb-invalid-mta 4.1+Debian13+nmu1
  exim4-daemon-light 4.84.2-2+deb8u3
  exim4-daemon-heavy 4.84.2-2+deb8u3
  esmtp-run 1.2-12
  dma 0.9-1
  courier-mta 0.73.1-1.6
  citadel-mta 8.24-1+b3

E: Package 'mail-transport-agent' has no installation candidate

最佳答案

Debian 设置为仅允许一个邮件传输代理,而您的安装命令尝试包含两个:ssmtp 和 sendmail/sendmail-bin。由于它们相互冲突,您需要从安装命令中删除其中之一。

关于Docker:无法纠正问题,您持有损坏的软件包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41966824/

相关文章:

c - 在 32 位 Debian Squeeze 下编译的 C 程序导致我 friend 的 64 位程序出现段错误

docker - 如何让 PyC​​harm 识别不完全称为 Dockerfile 的 Dockerfile?

Golang Dockerfile 失败

docker - 无法删除 docker 镜像

java - 如何找到所有基于图像的 PDF?

mysql - 在 debian 中连接 Excel 和 MySQL

php - docker无法找到尝试安装php扩展mysqli的软件包

docker - 通过Aurora在Mesos中使用大型Docker镜像启 Action 业可能很慢

macos - Docker - Mac 上 `dockerd` 的替换

linux - 可以在 Windows 上的 Docker 中运行 ARM/rpi 图像,但不能在 linux 上运行