docker工人:无法纠正问题,你已经打破了软件包

我有多次使用Dockerfile,没有问题。 现在我需要添加一些软件包(ssmtp和sendmail),当我添加他们的构build失败:

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。 由于它们相互冲突,您需要从安装命令中删除其中的一个。

如果sendmail依赖项是这样的,那么你的Python应用程序可以通过sendmail二进制文件发送电子邮件,只需安装ssmtp并将其configuration为使用外部MTA。

不build议尝试在Docker容器中运行sendmail