postfix for SMTP dovecot for IMAP
create Dockerfile with (substituting 'domainame' with your mail domain, 'username' and 'password' with the real username and password values you'd like created in the image):
############################################
FROM gthrasher/mailserver:latest
#expose SMTP and IMAP ports
EXPOSE 25 143
#update Postfix main.cf with mail domain and add user(s)
RUN postconf -e "mydestination=domainname, localhost.localdomain, localhost" && \
postconf -e "myorigin=domainname" && \
useradd -G mail -md /home/username1 username1 && echo 'username1:password1' | chpasswd && \
useradd -G mail -md /home/username username2 && echo 'username2:password2' | chpasswd
#####################################
Would typically build local image as follows (assuming Dockerfile is in current directory):
docker build -t localrepo/testmailserver:1.0 .
Then run like:
docker run -d -p 25:25 -p 143:143 --name mail_server localrepo/testmailserver:1.0
(obviously, make sure the ports on the on the docker host are not blocked by firewall or in use by any other processes)
Content type
Unrecognized
Digest
Size
97.4 MB
Last updated
about 10 years ago
docker pull gthrasher/mailserver