Docker-mailserver: Restart/reload dovecot

Created on 16 Mar 2017  路  8Comments  路  Source: tomav/docker-mailserver

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).

Most helpful comment

restart:

/usr/sbin/dovecot stop
/usr/sbin/dovecot -c /etc/dovecot/dovecot.conf

and reload:

/usr/sbin/dovecot reload

All 8 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rwarren picture rwarren  路  4Comments

xiao1201 picture xiao1201  路  4Comments

landergate picture landergate  路  4Comments

nicklayb picture nicklayb  路  4Comments

m-a-v picture m-a-v  路  4Comments