iRedMail 0.9.7 in a Docker container that leverages systemd to actually work. Sadly, because of systemd requirements, the image has to be run privileged (though processes within drop privs.), and it produces a rather FAT container in the end because iRedMail is designed to be installed on a rather complete O.S. debian:jessie is used as a base.
1) Configure it:
docker run --privileged -ti --name iRedMail \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /var/vmail:/var/vmail \
-p 25:25 -p 465:465 -p 587:587 \
-p 110:110 -p 143:143 -p 993:993 -p 995:995 \
-p 80:80 -p 443:433 \
When it's configured, in a separate terminal shut it down GRACEFULLY:
docker exec -it iRedMail shutdown now
2) To run it just start it up again:
docker start -i iRedMail
Remember to ALWAYS shut it down GRACEFULLY (iRedMail tends to stop working if it is shutdown abruptly, particularly mysql within it.)
/var/mail is exposed so you can store the mail on the host system, though this is not necessary.
GitHub source link: https://github.com/rhollan/docker-iRedMail