mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
8.75k stars 1.17k forks source link

dovecot-mailcow failed starting: Address already in use #2765

Closed tobischmobi closed 5 years ago

tobischmobi commented 5 years ago

Hello,

since I still haven't solved the problem, I'm going to ask here. Maybe someone can help me. When I try to start Mailcow, I constantly get the following error message:

WARNING: The WATCHDOG_NOTIFY_EMAIL variable is not set. Defaulting to a blank string.
Removing mailcowdockerized_dovecot-mailcow_1
mailcowdockerized_watchdog-mailcow_1 is up-to-date
mailcowdockerized_postfix-mailcow_1 is up-to-date
mailcowdockerized_sogo-mailcow_1 is up-to-date
mailcowdockerized_olefy-mailcow_1 is up-to-date
mailcowdockerized_mysql-mailcow_1 is up-to-date
mailcowdockerized_clamd-mailcow_1 is up-to-date
mailcowdockerized_redis-mailcow_1 is up-to-date
mailcowdockerized_unbound-mailcow_1 is up-to-date
Recreating b7750fafe897_mailcowdockerized_dovecot-mailcow_1 ...
mailcowdockerized_dockerapi-mailcow_1 is up-to-date
mailcowdockerized_memcached-mailcow_1 is up-to-date
mailcowdockerized_solr-mailcow_1 is up-to-date
mailcowdockerized_php-fpm-mailcow_1 is up-to-date
mailcowdockerized_nginx-mailcow_1 is up-to-date
Recreating b7750fafe897_mailcowdockerized_dovecot-mailcow_1 ... error

ERROR: for b7750fafe897_mailcowdockerized_dovecot-mailcow_1  Cannot start service dovecot-mailcow: Address already in use

ERROR: for dovecot-mailcow  Cannot start service dovecot-mailcow: Address already in use
ERROR: Encountered errors while bringing up the project.

I've already checked if another process is using one of the ports, but I didn't find one:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1018/mysqld
tcp        0      0 0.0.0.0:5683            0.0.0.0:*               LISTEN      932/sshd
tcp        0      0 127.0.0.1:13306         0.0.0.0:*               LISTEN      507/docker-proxy
tcp6       0      0 :::587                  :::*                    LISTEN      702/docker-proxy
tcp6       0      0 :::80                   :::*                    LISTEN      6831/apache2
tcp6       0      0 :::465                  :::*                    LISTEN      842/docker-proxy
tcp6       0      0 :::5683                 :::*                    LISTEN      932/sshd
tcp6       0      0 :::25                   :::*                    LISTEN      870/docker-proxy
tcp6       0      0 :::443                  :::*                    LISTEN      6831/apache2

Does anyone know why this error occurs? Thanks in advance for any help!

amorfo77 commented 5 years ago

Hi, as i know, that error raises when the IP and/or the port of the container you are trying to start is already in use. in mailcow the dovecot container has the ip fixed at 172.22.1.250, you can check if the ip is in use with docker network inspect mailcowdockerized_mailcow-network | grep 172.22.1.250

hope that helps.

tobischmobi commented 5 years ago

Thanks for your help, @amorfo77!

I get the following output with this command:

root@debian-nbg-cx11:/opt/mailcow-dockerized# docker network inspect mailcowdockerized_mailcow-network | grep 172.22.1.250
                "IPv4Address": "172.22.1.250/24",

However, this command doesn't show if the IP address is already in use or not. Or did I miss something?

DatAres37 commented 5 years ago

It appears when you inspect the network, so the address is indeed already in use. You can run docker network inspect mailcowdockerized_mailcow-network to look after the IP and see which container is using it. Have you tried stopping the container manually with docker stop mailcowdockerized_dovecot-mailcow_1 or b7750fafe897_mailcowdockerized_dovecot-mailcow_1? Then you should be able to start it again.

tobischmobi commented 5 years ago

@DatAres37 I just tried to stop mailcowdockerized_dovecot-mailcow_1 / b7750fafe897_mailcowdockerized_dovecot-mailcow_1. That didn't work. So I tried to stop all containers (docker stop $(docker ps -a -q)), which worked, but b7750fafe897_mailcowdockerized_dovecot-mailcow_1 (172.22.1.250/24) was still running. Any idea why that could be?

DatAres37 commented 5 years ago

I'm not a docker expert, but b7750fafe897_mailcowdockerized_dovecot-mailcow_1 sounds like a broken container name to me. Is there an error when you try to stop it? Can you remove the container with docker container rm? If it's a new install I'd try to uninstall and reinstall mailcow: https://mailcow.github.io/mailcow-dockerized-docs/u_e-deinstall/ This way you'll lose all data if you've no backup.

MrUnknownDE commented 5 years ago

For me, unfortunately, this case. Even after a fresh installation.

ERROR: for postfix-mailcow Cannot start service postfix-mailcow: driver failed programming external connectivity on endpoint mailcowdockerized_postfix-mailcow_1 (c87e352214bda1607234faa02f0e108a534900872edf489264f8c75262faffc8): Error starting userland proxy: listen tcp 0.0.0.0:25: bind: address already in use ERROR: Encountered errors while bringing up the project.

andryyy commented 5 years ago

It can be the freshest of fresh installations, when something else is blocking that port. :) Check the docs. Stop whatever listens on port 25.

MrUnknownDE commented 5 years ago

It has even been reinstalled the server, two to three times

Shadowghost commented 5 years ago

Check what runs on port 25 by running sudo lsof -i :25 (you may need to install lsof package for your distro) and report back or kill the reported daemon/program.

MrUnknownDE commented 5 years ago

Okey. It was the Linux-SMTP still active. Thanks.

extremeshok commented 5 years ago

The easiest way to setup a optimized docker host for mailcow:

Use a fresh ubuntu install, run the xshok-ubuntu-docker-host.sh script located here.

https://github.com/extremeshok/xshok-docker

tobischmobi commented 5 years ago

@DatAres37

It was indeed a dead container. Unfortunately, I couldn't remove it, so I tried to restart the docker service (service docker restart). After the restart, the broken container was no longer listed (docker network inspect mailcowdockerized_mailcow-network) and Mailcow was able to boot.

Thanks to all, who helped me!