I'm trying to get postfix working in a docker container on a raspberry pi. The following works
ENTRYPOINT service rsyslog restart && service postfix restart && sleep 2s && tail /var/log/syslog -f
But if I instead use the following, which is meant to run postfix in the foreground (according to the documentation, and linked from serverfault)
ENTRYPOINT postfix start-fg
then it starts up, but any attempt to send mail results in fatal: unknown service: smtp/tcp
My master.cf
contains
# service type private unpriv chroot wakeup maxproc command + args
smtp inet n - y - - smtpd
but having read many other issues around chroot, I tried turning that off, with no success.
I have also checked that smtp exists in both /etc/services
and /var/spool/postfix/etc/services
and that permissions are open for reading. I make sure of this with
RUN ln -snf /etc/services /var/spool/postfix/etc/services
-rw-r--r-- 1 root root 18774 Feb 3 23:28 /var/spool/postfix/etc/services
-rw-r--r-- 1 root root 18774 Feb 10 2019 /etc/services
#grep smtp /var/spool/postfix/etc/services
smtp 25/tcp mail
submissions 465/tcp ssmtp smtps urd # Submission over TLS [RFC8314]
#grep smtp /etc/services
smtp 25/tcp mail
submissions 465/tcp ssmtp smtps urd # Submission over TLS [RFC8314]
My full dockerfile
FROM --platform=linux/arm/v7 debian:stable-slim
RUN apt-get update
RUN apt-get install postfix rsyslog -y
COPY etc /etc # I have main.cf, mcaster.cf, virtual, and mailname copying in
# Build the virtual.db database file
RUN postmap /etc/postfix/virtual
# This gets smtp working https://serverfault.com/questions/655116/postfix-fails-to-send-mail-with-fatal-unknown-service-smtp-tcp
RUN ln -snf /etc/services /var/spool/postfix/etc/services
EXPOSE 25
ENTRYPOINT service rsyslog restart && service postfix restart && sleep 2s && tail /var/log/syslog -f
#ENTRYPOINT postfix start-fg
I would really prefer to use start-fg
both for best practices in having a single process in the container, and that it will make syslog log management cleaner.
Please comment if I've not included something important or if there are useful logs I can grab. I'm intermediate level on linux, so I'll do my best to get logs and traces but may need some guidance.