我正在从docker安装postfix服务器,然后将其部署到openshift。在我的本地docker容器postfix服务器启动正常,并能够发送电子邮件,但在Openshift失败。
我的Dockerfile的一部分:
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y postfix
RUN sed -i 's/relayhost.*/relayhost = <my.mail.host>/g' /etc/postfix/main.cf
RUN sed -i 's/myhostname.*/myhostname = <my.domain.name>/g' /etc/postfix/main.cf
RUN sed -i 's/smtp inet n - - - - smtpd/2525 inet n - n - - smtpd/g' /etc/postfix/master.cf
然后在entrypoint.sh中我使用:
重新启动服务器/etc/init.d/postfix restart
这在我的本地工作正常,我得到测试电子邮件。但是在OS控制台上它并没有启动。当我进入终端并尝试启动服务器时,我收到错误:
postfix: error: to submit mail, use the Postfix sendmail command
postfix: fatal: the postfix command is reserved for the superuser
没有创建其他日志 的/ var /日志/ maillog中
任何线索我应该在哪里看?
答案 0 :(得分:0)
当您在本地Docker上运行docker镜像时,它将以root
运行。
这是一个安全问题,默认情况下禁止在OpenShift上使用。或者更具体一点 - 如果您可以以root
用户身份运行,则它取决于您的OpenShift群集配置。
我不确定您是否可以在没有超级用户权限的情况下运行postfix,因此可能无法在不使您的容器成为特权的情况下在OpenShift中运行它。您可以尝试以下配置:OpenShift Origin: Enable dockerhub images that require root