我有 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 <[email protected]>
 ---> 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/

10-16 07:07