Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedelemantuano/01c9e64d2bc2c830ee785cb7b2ac87b3 to your computer and use it in GitHub Desktop.
Save fedelemantuano/01c9e64d2bc2c830ee785cb7b2ac87b3 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 \
&& chmod +r /var/log/maillog
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