docker-mailserver: After host reboot (and some container restarts) dovecot fails to run correctly

I have docker-mailserver setup and running, sending and receiving emails as expected, but sometimes after a server reboot, or a docker-compose restart, dovecot appears to break. The docker log gets flooded with the following lines every second until I stop or restart the container (hopefully working on the second try).

INFO spawned: 'dovecot' with pid 1099
INFO success: dovecot entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
INFO exited: dovecot (exit status 89; not expected)
INFO spawned: 'dovecot' with pid 1101
INFO success: dovecot entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
INFO exited: dovecot (exit status 89; not expected)
INFO spawned: 'dovecot' with pid 1103
INFO success: dovecot entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
INFO exited: dovecot (exit status 89; not expected)

I also see the following line in the log at sporadic places.

mail dovecot: master: Fatal: Dovecot is already running with PID 203 (read from /var/run/dovecot/master.pid)

The strange thing is that even though it says dovecot is running, I cannot connect any accounts over IMAP.

Here is my docker-compose.yml

version: '2'
services:
  mailserver:
    image: tvial/docker-mailserver:latest
    restart: always
    hostname: mail
    domainname: example.com
    container_name: mail.example.com-mailserver
    ports:
      - "25:25"
      - "587:587"
      - "993:993"
    volumes:
      - ./mailserver/maildata/:/var/mail
      - ./mailserver/mailstate/:/var/mail-state
      - ./mailserver/config/:/tmp/docker-mailserver/
      - /home/justin/docker/nginx-proxy/certificates/:/etc/letsencrypt/live
    environment:
      - ONE_DIR=1
      - SSL_TYPE=letsencrypt
      - DMS_DEBUG=1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 32 (19 by maintainers)

Most upvoted comments

FOUND the cause. There is a daily cron job /etc/cron.daily/spamasassin When you run it you get the loop:

mail                     | 2017-08-18 16:58:27,343 INFO exited: amavis (exit status 0; expected)
mail                     | Aug 18 16:58:27 mail postfix/smtpd[2429]: disconnect from localhost[127.0.0.1] ehlo=1 mail=1 rcpt=1 data=1 commands=4
mail                     | Aug 18 16:58:28 mail amavis[2509]: starting. /usr/sbin/amavisd-new at mail.xxx.net amavisd-new-2.10.1 (20141025), Unicode aware, LC_ALL="C"
mail                     | 2017-08-18 16:58:28,178 INFO spawned: 'amavis' with pid 2518
mail                     | 2017-08-18 16:58:28,844 INFO success: amavis entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)

And there is a post hook in: /etc/spamassassin/sa-update-hooks.d/amavisd-new It inits a restart and that causes it to detach from supervisor.

Made a PR to fix the issue see #699

Great! And thank @johansmitsnl

Merged, latest is currently building.