FROM ubuntu:14.04 ENV DEBIAN_FRONTEND noninteractive RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty main' | tee /etc/apt/sources.list RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ trusty main' | tee -a /etc/apt/sources.list RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty-updates main' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main' | tee -a /etc/apt/sources.list RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty universe' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ trusty universe' | tee -a /etc/apt/sources.list RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty-updates universe' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates universe' | tee -a /etc/apt/sources.list RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty multiverse' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ trusty multiverse' | tee -a /etc/apt/sources.list RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty-updates multiverse' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates multiverse' | tee -a /etc/apt/sources.list RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse' | tee -a /etc/apt/sources.list RUN echo 'deb http://security.ubuntu.com/ubuntu trusty-security main' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://security.ubuntu.com/ubuntu trusty-security main' | tee -a /etc/apt/sources.list RUN echo 'deb http://security.ubuntu.com/ubuntu trusty-security universe' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://security.ubuntu.com/ubuntu trusty-security universe' | tee -a /etc/apt/sources.list RUN echo 'deb http://security.ubuntu.com/ubuntu trusty-security multiverse' | tee -a /etc/apt/sources.list RUN echo 'deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse' | tee -a /etc/apt/sources.list RUN locale-gen en_GB en_GB.UTF-8 && dpkg-reconfigure locales RUN apt-get update RUN apt-get -y -q autoclean RUN apt-get -y -q autoremove RUN apt-get clean # prerequisites RUN apt-get update # install self-signed ssl certs RUN apt-get install -y --force-yes ssl-cert # Install postfix as MTA RUN apt-get install -y --force-yes postfix # Install dovecot as IMAP server RUN apt-get install -y --force-yes dovecot-imapd # postfix configuration RUN echo "mail.docker.container" > /etc/mailname ADD ./postfix.main.cf /etc/postfix/main.cf ADD ./postfix.master.cf.append /etc/postfix/master-additional.cf RUN cat /etc/postfix/master-additional.cf >> /etc/postfix/master.cf # configure settings script VOLUME ["/mail_config"] COPY process_settings /process_settings RUN chmod 755 /process_settings # add user vmail who own all mail folders VOLUME ["/vmail"] RUN groupadd -g 5000 vmail RUN useradd -g vmail -u 5000 vmail -d /vmail -m # dovecot configuration ADD ./dovecot.mail /etc/dovecot/conf.d/10-mail.conf ADD ./dovecot.ssl /etc/dovecot/conf.d/10-ssl.conf ADD ./dovecot.auth /etc/dovecot/conf.d/10-auth.conf ADD ./dovecot.master /etc/dovecot/conf.d/10-master.conf ADD ./dovecot.lda /etc/dovecot/conf.d/15-lda.conf ADD ./dovecot.imap /etc/dovecot/conf.d/20-imap.conf # add verbose logging #ADD ./internal/dovecot.logging /etc/dovecot/conf.d/10-logging.conf # smtp port for incoming mail EXPOSE 25 # imap port EXPOSE 143 # smtp port for outgoing EXPOSE 587 # todo: enable port 587 for outgoing mail, separate ports 25 and 587 # http://www.synology-wiki.de/index.php/Zusaetzliche_Ports_fuer_Postfix # start necessary services for operation (dovecot -F starts dovecot in the foreground to prevent container exit) ENTRYPOINT /process_settings; service rsyslog start; service postfix start; dovecot -F