Ubuntu dockerfile - mailutils安装

时间:2016-11-30 13:45:09

标签: linux ubuntu docker smtp dockerfile

我正在mailutils图片上通过dockerfile安装ubuntu

我这样做是通过:

RUN apt-get install -y mailutils

然而,在这一行我得到以下内容:

Please select the mail server configuration type that best meets your needs.

 No configuration:
  Should be chosen to leave the current configuration unchanged.
 Internet site:
  Mail is sent and received directly using SMTP.
 Internet with smarthost:
  Mail is received directly using SMTP or by running a utility such
  as fetchmail. Outgoing mail is sent using a smarthost.
 Satellite system:
  All mail is sent to another machine, called a 'smarthost', for delivery.
 Local only:
  The only delivered mail is the mail for local users. There is no network.

  1. No configuration  3. Internet with smarthost  5. Local only
  2. Internet Site     4. Satellite system

当我使用Debian图像做同样的事情时,我没有得到这个选项。

在使用-y时,我使用Dockerfile前缀来处理所有是/否安装问题。我该如何处理这样的选项?我尝试添加-2前缀。

有没有办法跳过这个?为什么ubuntudebian没有时需要这样做?尽管不需要这个输入,我已经检查过邮件和debian功能正确。

2 个答案:

答案 0 :(得分:2)

使用以下dockerfile

FROM ubuntu:latest
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get install -y mailutils

重要的是将debconf设置为noninteractive模式。

答案 1 :(得分:1)

你也可以使用this技巧,比如

FROM ubuntu:latest
RUN apt-get update && apt-get install -y
RUN echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections &&\
        echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections &&\
        apt-get install -y mailutils