Skip to content

Instantly share code, notes, and snippets.

@adepasquale
Last active February 22, 2021 08:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adepasquale/2efd04d6491b7e7be1bdced46ace09e9 to your computer and use it in GitHub Desktop.
Save adepasquale/2efd04d6491b7e7be1bdced46ace09e9 to your computer and use it in GitHub Desktop.
Dockerfile for Postfix server with catch-all configuration
FROM alpine:latest
RUN apk add --no-cache postfix postfix-pcre rsyslog
RUN postconf -e "myhostname=localhost" \
&& postconf -e "mynetworks_style=host" \
&& postconf -e "mail_spool_directory=/var/mail/" \
&& postconf -e "virtual_alias_maps=pcre:/etc/postfix/virtual" \
&& echo "/.*/ root" > /etc/postfix/virtual \
&& postmap /etc/postfix/virtual \
&& postalias /etc/postfix/aliases \
&& mkdir /var/mail
EXPOSE 25
VOLUME ["/var/mail/root"]
CMD ["sh", "-c", "rsyslogd; postfix start; tail -F /var/log/maillog"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment