Am 02.04.2018 um 16:10 schrieb Michael Segel:
> Has anyone successfully implemented a Kubernetes / Docker container setup for
> Postfix/Dovecot?
it works in my lab environment.
$ docker-compuse up -d postfix
Creating dockerpostfix_postfix_1 ... done
$ docker-compose exec postfix /bin/bash
root@postfix:/# postconf mail_version
mail_version = 3.3.0
root@postfix:/# ps afx
PID TTY STAT TIME COMMAND
338 pts/0 Ss 0:00 /bin/bash
345 pts/0 R+ 0:00 \_ ps afx
1 ? Ss 0:00 /bin/sh /usr/lib/postfix/postfix-script start-fg
335 ? Ss 0:00 /usr/lib/postfix/master
336 ? S 0:00 \_ pickup -l -t unix -u
337 ? S 0:00 \_ qmgr -l -t unix -u
The container's entrypoint is a binary, but at run time PID 1 is /bin/sh.
That result in hard container shutdown: Docker send SIGTERM to a sh, not to
usr/lib/postfix/master.
As the sh will not terminate "master", Docker will KILL the whole container
later.
It would be better, if /usr/lib/postfix/master is PID 1.
To be complete: that's my docker-compose.yml:
services:
postfix:
entrypoint: ["/usr/sbin/postfix", "start-fg"]
hostname: postfix
image: $(replace_with_your_postfix_image)
restart: unless-stopped
volumes:
- /dev/log:/dev/log
- ./config:/etc/postfix/config
- ./lib:/var/lib/postfix
- ./spool:/var/spool/postfix
version: '2.3'
and the Dockerfile:
FROM $(replace_with_your_debian_base)
RUN set -ex ; \
apt-get -qq update \
&& apt-get -qq --no-install-recommends install
$self_compiled_postfix_package \
&& apt-get -qq --purge autoremove \
&& apt-get -qq clean \
&& rm -rf /var/lib/apt/lists/*
Andreas