在Dockerfile

时间:2017-11-05 19:28:54

标签: dockerfile apt

我正在尝试创建一个Dockerfile来安装postfix,但是安装会问这个问题:

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

Dockerfile

FROM ubuntu:xenial

MAINTAINER xxx

RUN apt-get update \
 && apt-get install -y postfix postfix-mysql dovecot-core dovecot-imapd dovecot-lmtpd dovecot-mysql mariadb-server\
 && apt-get clean

如何以交互方式提供Postfix安装的答案?

1 个答案:

答案 0 :(得分:1)

尝试更改Dockerfile中的RUN指令:

 RUN apt-get update\
 && DEBIAN_FRONTEND=noninteractive apt-get install -y postfix postfix-mysql dovecot-core dovecot-imapd dovecot-lmtpd dovecot-mysql mariadb-server\
 && apt-get clean

或者更好的解决方案可以是:

在您的Dockerfile ARG DEBIAN_FRONTEND=noninteractive中添加此说明 (它仅在构建期间可用。)