While docker-compose exec mail service postfix restart or
docker-compose exec mail /etc/init.d/postfix restart work for restarting (or reloading) the postfix daemon (after a config change), it doesn't work with the dovecot service (no service 'dovecot' found, neither using service dovecot nor using /etc/init.d/dovecot).
just had a some issues with dovecot myself. If dovecot is not running but /var/run/dovecot/master.pid exists, then dovecot will not start anymore.
For me the fix was:
rm /var/run/dovecot/master.pid
/usr/sbin/dovecot -c /etc/dovecot/dovecot.conf # or restart docker
@Zauberstuhl: Thank you for the workaround. Though in my case, postfix and dovecot run and I need to restart/reload dovecot after a config change. There seems to be no command/script available for this currently short of docker-compose restart for restarting the whole container setup (including unnecessary downtime).
restart:
/usr/sbin/dovecot stop
/usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
and reload:
/usr/sbin/dovecot reload
Some convenience scripts would be nice, e.g. for cert regeneration, e.g. postfix-restart.sh, postfix-reload.sh, dovecot-restart.sh and dovecot-reload.sh.
The commands have been provided by @Zauberstuhl.
Why not just exec them? (same thing you will do without docker).
The purpose of this image is to bootstrap easily a mail server. The usage once running should be more or less the same you should have without docker.
Too much abstraction won't allow people to understand what they do, and they won't be able to do the same on a classic server.
Just my 2 cents
Then I am happy with this. Though I wonder why there is a service for postfix but not for dovecot.
When starting dovecot (after stopping it) using aforementioned command
docker exec /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
results in docker exec hanging instead of exiting.
Also within a bash opened with docker exec, the bash won't exit as long as the dovecot process still runs.
How can I start dovecot in background the proper way?
The container name is missing in your command (a typo when pasting in Github, I suppose).
Yep, the command starts a process in foreground.
The container uses this part of code https://github.com/tomav/docker-mailserver/blob/master/target/start-mailserver.sh#L305-L317
You may have a look.
Most helpful comment
restart:
and reload: