Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IPv6 and/or multiple IPv4 addresses] dovecot/nginx bindings due to "address already in use" #3900

Open
4 tasks done
bryanpedini opened this issue Dec 15, 2020 · 41 comments
Open
4 tasks done
Labels
bug neverstale Bot doesn't mark the issue or PR as stale

Comments

@bryanpedini
Copy link

bryanpedini commented Dec 15, 2020

Prior to placing the issue, please check following: (fill out each checkbox with an X once done)

  • I understand that not following or deleting the below instructions will result in immediate closure and/or deletion of my issue.
  • I have understood that this bug report is dedicated for bugs, and not for support-related inquiries.
  • I have understood that answers are voluntary and community-driven, and not commercial support.
  • I have verified that my issue has not been already answered in the past. I also checked previous issues.

Summary

I'm sure I'm 101% idiot and missed something, let's start with that 😄
I'm currently on commit 329fe3f, trying to configure IPv6 because I forgot that I have registered the DNS names but not configured it properly on the containers yet (so Let'sEncrypt fails, obviously). I'm following the official guide here.
However it fails due to "bind: address already in use":
Screenshot_20201215_164150
This happens only when using the override YAML file with IPv6, when renaming it to .bak everything works again with all the other files untouched.

I also tried to update (commit 0846013 plus moo@cow.moo before and after update commits) but with same results, unfortunately...

Logs

As per screenshot above, full logs here:
debug.log (as per docker-compose logs -t --no-color --tail=all | tee debug.log)

Reproduction

Fairly simple dockerized version of Mailcow, almost no customization to the config files, adding IPv6. (basically nothing else).
Sorry, can't better describe how to reproduce, I'm just enabling IPv6 on a perfectly working Mailcow environment, after finally having configured it on the host machine...

System information

Question Answer
My operating system Debian Gnu/Linux 10 (10.6)
Is Apparmor, SELinux or similar active? No
Virtualization technlogy (KVM, VMware, Xen, etc - LXC and OpenVZ are not supported ProxMox (KVM)
Server/VM specifications (Memory, CPU Cores) 2 CPUs, 6GiB RAM, 40GiB drive
Docker Version (docker version) 19.03.13
Docker-Compose Version (docker-compose version) 3.7.7
Reverse proxy (custom solution) Nothing, VM (and IP) dedicated to Mailcow-Dockerized
  • Output of git diff origin/master, any other changes to the code?
    • Redacted for privacy, data/assets/ssl-example/cert.pem and data/assets/ssl-example/key.pem.
  • All third-party firewalls and custom iptables rules are unsupported. Please check the Docker docs about how to use Docker with your own ruleset. Nevertheless, iptabels output can help us to help you: iptables -L -vn, ip6tables -L -vn, iptables -L -vn -t nat and ip6tables -L -vn -t nat.
  • DNS problems? Please run docker exec -it $(docker ps -qf name=acme-mailcow) dig +short stackoverflow.com @172.22.1.254 (set the IP accordingly, if you changed the internal mailcow network) and post the output.
    • Screenshot_20201215_171742

Thanks to everyone involved in the Mailcow and Mailcow-Dockerized projects, and thank you in advance for any help!

@bryanpedini
Copy link
Author

As alwais, I forget to include some important details:

@andryyy
Copy link
Contributor

andryyy commented Dec 15, 2020

Hi, you don't need to enable IPv6, it is enabled by default. What am I missing? :)

@bryanpedini
Copy link
Author

Hi Andryyy, thank you for your quick reply and info, I would like to configure the machine IPv6 also configured in my domain DNS records, for nginx to bind and work correctly (ATM it can't renew the certificates) and for Postfix/Dovecot to send and receive emails via v6.

@berkaycagir
Copy link

Do you have an only single IPv6 address configured on the host machine?

@bryanpedini
Copy link
Author

Do you have an only single IPv6 address configured on the host machine?

Yes I do...
I do need either a subnet of addresses, or to configure the "ipv6nat" container, right? 😞

@berkaycagir
Copy link

No, I run it just like that too. Looking at your docker-compose.override.yml and mailcow.conf, you don't seem to need the docker-compose.override.yml; because from what I understand if there's only a single IPv4 and IPv6 address, and if there's nothing running on the host machine which would conflict with mailcow's containers, you wouldn't need to do any kind of bindings by hand.

Did you try running it without the docker-compose.override.yml file? Just run docker-compose down, rename the file to something else from the end of it, and run docker-compose up -d.

@bryanpedini
Copy link
Author

Did you try running it without the docker-compose.override.yml file? Just run docker-compose down, rename the file to something else from the end of it, and run docker-compose up -d.

As described in the first post, when running without the override file it works fine.

And no, netstat -tupln shows no binding on the IPv6 neither before docker-compose upping, nor after, sadly..

@bryanpedini
Copy link
Author

Talking about this sentence:

This happens only when using the override YAML file with IPv6, when renaming it to .bak everything works again with all the other files untouched.

@berkaycagir
Copy link

I should definitely try to learn how to read sometime 😛 Sorry about that. What does docker ps show after bringing the stack up without the override file?

@bryanpedini
Copy link
Author

What does docker ps show after bringing the stack up without the override file?

Sorry for the late reply... family... meh...
On the topic then: it brings up the normal stack, with every single container working as expected.

@berkaycagir
Copy link

berkaycagir commented Dec 31, 2020

And no, netstat -tupln shows no binding on the IPv6 neither before docker-compose upping, nor after, sadly..

It does not show a binding for me too (when I don't have the override file), but I can telnet MAILCOW_IPV6 587 (from another machine) successfully. Did you give that a try?

@bryanpedini
Copy link
Author

bryanpedini commented Jan 1, 2021

Did you give that a try?

No, but I did just now, and as you said, I can telnet port 587 from another IPv6 capable machine.
I can even cURL port 443 in HTTPS.
Without the override............

Okay so my issue with the certificates was not related to the fact IPv6 is not working, because clearly it is (even tho it doesn't show up bindings for docker-proxy like it should)?

@kunago
Copy link

kunago commented Mar 17, 2021

I seem to have the same issue. Unlike maybe others I use multiple IPv6 and need to bind mailcow with one only. I created the override as was in the docs:

version: '2.1'
services:

  dovecot-mailcow:
    ports:
      - '2a02:XXXX:XXXX:XXXX::1:143:143'
      - '2a02:XXXX:XXXX:XXXX::1:993:993'
      - '2a02:XXXX:XXXX:XXXX::1:110:110'
      - '2a02:XXXX:XXXX:XXXX::1:995:995'
      - '2a02:XXXX:XXXX:XXXX::1:4190:4190'

  postfix-mailcow:
    ports:
      - '2a02:XXXX:XXXX:XXXX::1:25:25'
      - '2a02:XXXX:XXXX:XXXX::1:465:465'
      - '2a02:XXXX:XXXX:XXXX::1:587:587'

  nginx-mailcow:
    ports:
      - '2a02:XXXX:XXXX:XXXX::1:80:80'
      - '2a02:XXXX:XXXX:XXXX::1:443:443'

This is the output from the log:

xxx@xxx:/opt/mailcow# docker-compose down && sleep 3 && docker-compose up -d
Stopping docker-mailcow_acme-mailcow_1      ... done
Stopping docker-mailcow_postfix-mailcow_1   ... done
Stopping docker-mailcow_dovecot-mailcow_1   ... done
Stopping docker-mailcow_nginx-mailcow_1     ... done
Stopping docker-mailcow_mysql-mailcow_1     ... done
Stopping docker-mailcow_sogo-mailcow_1      ... done
Stopping docker-mailcow_ejabberd-mailcow_1  ... done
Stopping docker-mailcow_php-fpm-mailcow_1   ... done
Stopping docker-mailcow_watchdog-mailcow_1  ... done
Stopping docker-mailcow_unbound-mailcow_1   ... done
Stopping docker-mailcow_ipv6nat-mailcow_1   ... done
Stopping docker-mailcow_rspamd-mailcow_1    ... done
Stopping docker-mailcow_netfilter-mailcow_1 ... done
Stopping docker-mailcow_memcached-mailcow_1 ... done
Stopping docker-mailcow_solr-mailcow_1      ... done
Stopping docker-mailcow_olefy-mailcow_1     ... done
Stopping docker-mailcow_redis-mailcow_1     ... done
Stopping docker-mailcow_clamd-mailcow_1     ... done
Stopping docker-mailcow_dockerapi-mailcow_1 ... done
Removing docker-mailcow_acme-mailcow_1      ... done
Removing docker-mailcow_postfix-mailcow_1   ... done
Removing docker-mailcow_dovecot-mailcow_1   ... done
Removing docker-mailcow_nginx-mailcow_1     ... done
Removing docker-mailcow_mysql-mailcow_1     ... done
Removing docker-mailcow_sogo-mailcow_1      ... done
Removing docker-mailcow_ejabberd-mailcow_1  ... done
Removing docker-mailcow_php-fpm-mailcow_1   ... done
Removing docker-mailcow_watchdog-mailcow_1  ... done
Removing docker-mailcow_unbound-mailcow_1   ... done
Removing docker-mailcow_ipv6nat-mailcow_1   ... done
Removing docker-mailcow_rspamd-mailcow_1    ... done
Removing docker-mailcow_netfilter-mailcow_1 ... done
Removing docker-mailcow_memcached-mailcow_1 ... done
Removing docker-mailcow_solr-mailcow_1      ... done
Removing docker-mailcow_olefy-mailcow_1     ... done
Removing docker-mailcow_redis-mailcow_1     ... done
Removing docker-mailcow_clamd-mailcow_1     ... done
Removing docker-mailcow_dockerapi-mailcow_1 ... done
Removing network docker-mailcow_mailcow-network
Creating network "docker-mailcow_mailcow-network" with driver "bridge"
Creating docker-mailcow_dockerapi-mailcow_1 ... done
Creating docker-mailcow_memcached-mailcow_1 ... done
Creating docker-mailcow_watchdog-mailcow_1  ... done
Creating docker-mailcow_unbound-mailcow_1   ... done
Creating docker-mailcow_clamd-mailcow_1     ... done
Creating docker-mailcow_solr-mailcow_1      ... done
Creating docker-mailcow_olefy-mailcow_1     ... done
Creating docker-mailcow_redis-mailcow_1     ... done
Creating docker-mailcow_ejabberd-mailcow_1  ... done
Creating docker-mailcow_sogo-mailcow_1      ... done
Creating docker-mailcow_mysql-mailcow_1     ... done
Creating docker-mailcow_php-fpm-mailcow_1   ... done
Creating docker-mailcow_postfix-mailcow_1   ...
Creating docker-mailcow_postfix-mailcow_1   ... error
Creating docker-mailcow_nginx-mailcow_1     ...
WARNING: Host is already in use by another container

ERROR: for docker-mailcow_postfix-mailcow_1  Cannot start service postfix-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_postfix-mailcow_1 (a244858ccb4161d83174591f06b79a1961592b93087752de1b381a56e6546629): Error starting userland proxy: listen tcp6 [::]:587: bind: address alrCreating docker-mailcow_dovecot-mailcow_1   ... error
WARNING: Host is already in use by another container

ERROR: for docker-mailcow_dovecot-mailcow_1  Cannot start service dovecot-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_dovecot-mailcow_1 (d38ff26aa5c3b4f46ea27792b43d0574c2b81e8414e4d6200796a40e42db9790): Error starting userland proxy: listen tcp6 [::]:4190: bind: address alCreating docker-mailcow_nginx-mailcow_1     ... done
Creating docker-mailcow_acme-mailcow_1      ... done

ERROR: for postfix-mailcow  Cannot start service postfix-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_postfix-mailcow_1 (a244858ccb4161d83174591f06b79a1961592b93087752de1b381a56e6546629): Error starting userland proxy: listen tcp6 [::]:587: bind: address already in use

ERROR: for dovecot-mailcow  Cannot start service dovecot-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_dovecot-mailcow_1 (d38ff26aa5c3b4f46ea27792b43d0574c2b81e8414e4d6200796a40e42db9790): Error starting userland proxy: listen tcp6 [::]:4190: bind: address already in use
ERROR: Encountered errors while bringing up the project.

I can confirm there is no other program listening on port 587

ss -lp | grep submission
tcp   LISTEN     0       128           0.0.0.0:submission          0.0.0.0:*     users:(("docker-proxy",pid=8407,fd=4))
tcp   LISTEN     0       128           0.0.0.0:submissions         0.0.0.0:*     users:(("docker-proxy",pid=8439,fd=4))
tcp   LISTEN     0       128              [::]:submission             [::]:*     users:(("docker-proxy",pid=8413,fd=4))
tcp   LISTEN     0       128              [::]:submissions            [::]:*     users:(("docker-proxy",pid=8446,fd=4))

@guilhermelepore
Copy link

I seem to have the same issue. Unlike maybe others I use multiple IPv6 and need to bind mailcow with one only. I created the override as was in the docs:

version: '2.1'
services:

  dovecot-mailcow:
    ports:
      - '2a02:XXXX:XXXX:XXXX::1:143:143'
      - '2a02:XXXX:XXXX:XXXX::1:993:993'
      - '2a02:XXXX:XXXX:XXXX::1:110:110'
      - '2a02:XXXX:XXXX:XXXX::1:995:995'
      - '2a02:XXXX:XXXX:XXXX::1:4190:4190'

  postfix-mailcow:
    ports:
      - '2a02:XXXX:XXXX:XXXX::1:25:25'
      - '2a02:XXXX:XXXX:XXXX::1:465:465'
      - '2a02:XXXX:XXXX:XXXX::1:587:587'

  nginx-mailcow:
    ports:
      - '2a02:XXXX:XXXX:XXXX::1:80:80'
      - '2a02:XXXX:XXXX:XXXX::1:443:443'

This is the output from the log:

xxx@xxx:/opt/mailcow# docker-compose down && sleep 3 && docker-compose up -d
Stopping docker-mailcow_acme-mailcow_1      ... done
Stopping docker-mailcow_postfix-mailcow_1   ... done
Stopping docker-mailcow_dovecot-mailcow_1   ... done
Stopping docker-mailcow_nginx-mailcow_1     ... done
Stopping docker-mailcow_mysql-mailcow_1     ... done
Stopping docker-mailcow_sogo-mailcow_1      ... done
Stopping docker-mailcow_ejabberd-mailcow_1  ... done
Stopping docker-mailcow_php-fpm-mailcow_1   ... done
Stopping docker-mailcow_watchdog-mailcow_1  ... done
Stopping docker-mailcow_unbound-mailcow_1   ... done
Stopping docker-mailcow_ipv6nat-mailcow_1   ... done
Stopping docker-mailcow_rspamd-mailcow_1    ... done
Stopping docker-mailcow_netfilter-mailcow_1 ... done
Stopping docker-mailcow_memcached-mailcow_1 ... done
Stopping docker-mailcow_solr-mailcow_1      ... done
Stopping docker-mailcow_olefy-mailcow_1     ... done
Stopping docker-mailcow_redis-mailcow_1     ... done
Stopping docker-mailcow_clamd-mailcow_1     ... done
Stopping docker-mailcow_dockerapi-mailcow_1 ... done
Removing docker-mailcow_acme-mailcow_1      ... done
Removing docker-mailcow_postfix-mailcow_1   ... done
Removing docker-mailcow_dovecot-mailcow_1   ... done
Removing docker-mailcow_nginx-mailcow_1     ... done
Removing docker-mailcow_mysql-mailcow_1     ... done
Removing docker-mailcow_sogo-mailcow_1      ... done
Removing docker-mailcow_ejabberd-mailcow_1  ... done
Removing docker-mailcow_php-fpm-mailcow_1   ... done
Removing docker-mailcow_watchdog-mailcow_1  ... done
Removing docker-mailcow_unbound-mailcow_1   ... done
Removing docker-mailcow_ipv6nat-mailcow_1   ... done
Removing docker-mailcow_rspamd-mailcow_1    ... done
Removing docker-mailcow_netfilter-mailcow_1 ... done
Removing docker-mailcow_memcached-mailcow_1 ... done
Removing docker-mailcow_solr-mailcow_1      ... done
Removing docker-mailcow_olefy-mailcow_1     ... done
Removing docker-mailcow_redis-mailcow_1     ... done
Removing docker-mailcow_clamd-mailcow_1     ... done
Removing docker-mailcow_dockerapi-mailcow_1 ... done
Removing network docker-mailcow_mailcow-network
Creating network "docker-mailcow_mailcow-network" with driver "bridge"
Creating docker-mailcow_dockerapi-mailcow_1 ... done
Creating docker-mailcow_memcached-mailcow_1 ... done
Creating docker-mailcow_watchdog-mailcow_1  ... done
Creating docker-mailcow_unbound-mailcow_1   ... done
Creating docker-mailcow_clamd-mailcow_1     ... done
Creating docker-mailcow_solr-mailcow_1      ... done
Creating docker-mailcow_olefy-mailcow_1     ... done
Creating docker-mailcow_redis-mailcow_1     ... done
Creating docker-mailcow_ejabberd-mailcow_1  ... done
Creating docker-mailcow_sogo-mailcow_1      ... done
Creating docker-mailcow_mysql-mailcow_1     ... done
Creating docker-mailcow_php-fpm-mailcow_1   ... done
Creating docker-mailcow_postfix-mailcow_1   ...
Creating docker-mailcow_postfix-mailcow_1   ... error
Creating docker-mailcow_nginx-mailcow_1     ...
WARNING: Host is already in use by another container

ERROR: for docker-mailcow_postfix-mailcow_1  Cannot start service postfix-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_postfix-mailcow_1 (a244858ccb4161d83174591f06b79a1961592b93087752de1b381a56e6546629): Error starting userland proxy: listen tcp6 [::]:587: bind: address alrCreating docker-mailcow_dovecot-mailcow_1   ... error
WARNING: Host is already in use by another container

ERROR: for docker-mailcow_dovecot-mailcow_1  Cannot start service dovecot-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_dovecot-mailcow_1 (d38ff26aa5c3b4f46ea27792b43d0574c2b81e8414e4d6200796a40e42db9790): Error starting userland proxy: listen tcp6 [::]:4190: bind: address alCreating docker-mailcow_nginx-mailcow_1     ... done
Creating docker-mailcow_acme-mailcow_1      ... done

ERROR: for postfix-mailcow  Cannot start service postfix-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_postfix-mailcow_1 (a244858ccb4161d83174591f06b79a1961592b93087752de1b381a56e6546629): Error starting userland proxy: listen tcp6 [::]:587: bind: address already in use

ERROR: for dovecot-mailcow  Cannot start service dovecot-mailcow: driver failed programming external connectivity on endpoint docker-mailcow_dovecot-mailcow_1 (d38ff26aa5c3b4f46ea27792b43d0574c2b81e8414e4d6200796a40e42db9790): Error starting userland proxy: listen tcp6 [::]:4190: bind: address already in use
ERROR: Encountered errors while bringing up the project.

I can confirm there is no other program listening on port 587

ss -lp | grep submission
tcp   LISTEN     0       128           0.0.0.0:submission          0.0.0.0:*     users:(("docker-proxy",pid=8407,fd=4))
tcp   LISTEN     0       128           0.0.0.0:submissions         0.0.0.0:*     users:(("docker-proxy",pid=8439,fd=4))
tcp   LISTEN     0       128              [::]:submission             [::]:*     users:(("docker-proxy",pid=8413,fd=4))
tcp   LISTEN     0       128              [::]:submissions            [::]:*     users:(("docker-proxy",pid=8446,fd=4))

I have exactly the same problem. Have you managed to solve it?

@kunago
Copy link

kunago commented May 19, 2021

No, I did not. I had to leave IPv6 alone for now and it's running on IPv4 only.

@guilhermelepore
Copy link

@bryanpedini Any suggestion of how can we solve this?

I have multiple IPv6 assigned to my host NIC, but I need to bind just one IPv6 to mailcow.

@bryanpedini
Copy link
Author

Why do you ask me? 😄

I only have one IPv6 address configured in my VM and I didn't need to create the override file, since it gets used automatically (yet somehow there is no binding on any port in v6 🤨)

Anyway, if there's something to learn from this issue, if I may suggest, is that IPv6 on Mailow Dockerized probably would benefit from a complete overhaul (or at least a complete check), since it's unclear how to use it for many people.

@kunago
Copy link

kunago commented May 20, 2021

@bryanpedini Any suggestion of how can we solve this?

I have multiple IPv6 assigned to my host NIC, but I need to bind just one IPv6 to mailcow.

I have multiple IPv4 and IPv6. With IPv4 it's not that easy already. I tried to use some proxy but I did not not succeed. The biggest problem is with certificates, so you need to set up the proxy to query for them, which I could not set up to work with no issues. The only way is to have an extra IPv4 for anything else but Mailcow.

As for IPv6, we already know, that's a problem.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale Please update the issue with current status, unclear if it's still open/needed. label Jul 19, 2021
@bryanpedini
Copy link
Author

STFU stale bot!

@github-actions github-actions bot removed the stale Please update the issue with current status, unclear if it's still open/needed. label Jul 19, 2021
@bryanpedini bryanpedini changed the title IPv6 breaks postfix, dovecot and nginx bindings due to "address already in use" [IPv6 and/or multiple IPv4 addresses] dovecot/nginx bindings due to "address already in use" Jul 19, 2021
@bryanpedini
Copy link
Author

@kunago seems to have the same issue under multiple IPv4 addresses, perhaps it's the same root cause so I updated the issue title...

@xPathin
Copy link

xPathin commented Aug 6, 2021

It's actually very easy to fix, it happens because by default in the docker compose file the ports bind on all interface ip's.
So, as soon as you have multiple ip's or sometimes even on dual stack, it can just break.

I fixed it by adding 2 new keys to my mailcow.conf:

BIND_V4=my.ip.v.4
BIND_V6=my:ip:ver:sion::6

And then changing the docker-compose.yml and changing all public port bindings there to include the BIND_V4 key, for example (do the same for dovecot, I did that this way to hope that I can avoid future merge conflicts):

services:    
    postfix-mailcow:
      image: mailcow/postfix:1.65
      ...
      ports:
        - "${BIND_V4:-0.0.0.0}:${SMTP_PORT:-25}:25"
        - "${BIND_V4:-0.0.0.0}:${SMTPS_PORT:-465}:465"
        - "${BIND_V4:-0.0.0.0}:${SUBMISSION_PORT:-587}:587"

And also creating a docker-compose.override.yml with the following content:

version: '2.1'
services:

    dovecot-mailcow:
      ports:
        - "${BIND_V6:-::}:${IMAP_PORT:-143}:143"
        - "${BIND_V6:-::}:${IMAPS_PORT:-993}:993"
        - "${BIND_V6:-::}:${POP_PORT:-110}:110"
        - "${BIND_V6:-::}:${POPS_PORT:-995}:995"
        - "${BIND_V6:-::}:${SIEVE_PORT:-4190}:4190"

    postfix-mailcow:
      ports:
        - '${BIND_V6:-::}:25:25'
        - '${BIND_V6:-::}:465:465'
        - '${BIND_V6:-::}:587:587'

    nginx-mailcow:
      ports:
        - '${BIND_V6:-::}:80:80'
        - '${BIND_V6:-::}:443:443'

@bryanpedini
Copy link
Author

can't we just override everything in the appropriate file, and put both v4 and v6 bindings in the override file?

@ghost
Copy link

ghost commented Aug 6, 2021

@xPathin can't SNAT do what you describe in your answer https://mailcow.github.io/mailcow-dockerized-docs/firststeps-snat/?

Otherwise the docs clearly explain how to bind to a specific IP address: https://mailcow.github.io/mailcow-dockerized-docs/firststeps-ip_bindings/

@bryanpedini
Copy link
Author

bryanpedini commented Aug 6, 2021

@mthld to be clear, the second link you posted (https://mailcow.github.io/mailcow-dockerized-docs/firststeps-ip_bindings/) is the exact guide I followed, the one that caused my problems, and the reason why I ultimately opened this issue on GH.

Maybe the issue isn't that "this thing X doesn't work" but "this procedure ABC described in the official doc doesn't work since version XYZ of the product", but in any case something doesn't work, hence this #3900.

@ghost
Copy link

ghost commented Aug 6, 2021

@mthld to be clear, the second link you posted (https://mailcow.github.io/mailcow-dockerized-docs/firststeps-ip_bindings/) is the exact guide I followed, the one that caused my problems, and the reason why I ultimately opened this issue on GH.

Maybe the issue isn't that "this thing X doesn't work" but "this procedure ABC described in the official doc doesn't work since version XYZ of the product", but in any case something doesn't work, hence this #3900.

@bryanpedini I see. Sorry I didn't read thoroughly your first post, I didn't saw the link the first time.

@bryanpedini
Copy link
Author

@bryanpedini I see. Sorry I didn't read thoroughly your first post, I didn't saw the link the first time.

no problem, now the only thing left to do is understand if just the doc isn't updated, or there actually is and underlying issue on the software itself...

@github-actions
Copy link

github-actions bot commented Oct 6, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale Please update the issue with current status, unclear if it's still open/needed. label Oct 6, 2021
@bryanpedini
Copy link
Author

STFU stalebot

@github-actions github-actions bot removed the stale Please update the issue with current status, unclear if it's still open/needed. label Oct 6, 2021
@ghost
Copy link

ghost commented Oct 6, 2021

Annoying indeed. ☹️

@Tealk
Copy link

Tealk commented Oct 27, 2021

The solution given in #3900 (comment) does not work for me

docker-compose up -d
Creating network "mailcowdockerized_mailcow-network" with driver "bridge"
WARNING: Found orphan containers (mailcowdockerized_ipv6nat-mailcow_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating mailcowdockerized_solr-mailcow_1      ... done
Creating mailcowdockerized_sogo-mailcow_1      ... done
Creating mailcowdockerized_watchdog-mailcow_1  ... done
Creating mailcowdockerized_redis-mailcow_1     ... done
Creating mailcowdockerized_memcached-mailcow_1 ... done
Creating mailcowdockerized_olefy-mailcow_1     ... done
Creating mailcowdockerized_dockerapi-mailcow_1 ... done
Creating mailcowdockerized_clamd-mailcow_1     ... done
Creating mailcowdockerized_unbound-mailcow_1   ... done
Creating mailcowdockerized_mysql-mailcow_1     ... done
Creating mailcowdockerized_php-fpm-mailcow_1   ... 
Creating mailcowdockerized_dovecot-mailcow_1   ... 
Creating mailcowdockerized_postfix-mailcow_1   ... 
Creating mailcowdockerized_postfix-mailcow_1   ... error

ERROR: for mailcowdockerized_postfix-mailcow_1  Cannot start service postfix-mailcow: driver failed programming external connectivity on endpoint mailcowdockerized_postfix-mailcow_1 (f73df09dbb5890e48071b6aa906468c1698ea48471abd9af2f963ef07Creating mailcowdockerized_dovecot-mailcow_1   ... error
WARNING: Host is already in use by another container

Creating mailcowdockerized_php-fpm-mailcow_1   ... done
 connectivity on endpoint mailcowdockerized_dovecot-mailcow_1 (8d4c83f24a788fb3f786b9d4093330b293d0282ca82c5f0e146650956b9bcb0e): Error starting userland proxy: listen tcp6 [MYIPV6]:4190: bind: cannot assign requested address
Creating mailcowdockerized_nginx-mailcow_1     ... 
Creating mailcowdockerized_nginx-mailcow_1     ... error

ERROR: for mailcowdockerized_nginx-mailcow_1  Cannot start service nginx-mailcow: driver failed programming external connectivity on endpoint mailcowdockerized_nginx-mailcow_1 (6d42e20c6fb01a75fd3673928bdf3345abf64f326c4bf718f50c106e0e2f6a39): Error starting userland proxy: listen tcp6 [MYIPV6]:443: bind: cannot assign requested address

ERROR: for postfix-mailcow  Cannot start service postfix-mailcow: driver failed programming external connectivity on endpoint mailcowdockerized_postfix-mailcow_1 (f73df09dbb5890e48071b6aa906468c1698ea48471abd9af2f963ef07b88ad14): Error starting userland proxy: listen tcp6 [MYIPV6]:587: bind: cannot assign requested address

ERROR: for dovecot-mailcow  Cannot start service dovecot-mailcow: driver failed programming external connectivity on endpoint mailcowdockerized_dovecot-mailcow_1 (8d4c83f24a788fb3f786b9d4093330b293d0282ca82c5f0e146650956b9bcb0e): Error starting userland proxy: listen tcp6 [MYIPV6]:4190: bind: cannot assign requested address

ERROR: for nginx-mailcow  Cannot start service nginx-mailcow: driver failed programming external connectivity on endpoint mailcowdockerized_nginx-mailcow_1 (6d42e20c6fb01a75fd3673928bdf3345abf64f326c4bf718f50c106e0e2f6a39): Error starting userland proxy: listen tcp6 [MYIPV6]:443: bind: cannot assign requested address
ERROR: Encountered errors while bringing up the project.

@xPathin
Copy link

xPathin commented Oct 27, 2021

The solution given in #3900 (comment) does not work for me

You need to explicilty set the IP on your other services too.

@Tealk
Copy link

Tealk commented Oct 28, 2021

You need to explicilty set the IP on your other services too.

what other services?

@milkmaker
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@milkmaker milkmaker added the stale Please update the issue with current status, unclear if it's still open/needed. label Dec 27, 2021
@bryanpedini
Copy link
Author

STFU stalebot

quote.

@milkmaker milkmaker removed the stale Please update the issue with current status, unclear if it's still open/needed. label Dec 27, 2021
@milkmaker
Copy link
Collaborator

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@milkmaker milkmaker added the stale Please update the issue with current status, unclear if it's still open/needed. label Feb 26, 2022
@bryanpedini
Copy link
Author

STFU stalebot

quote.

quote.

Can we take a look at what needs to be done for this not to happen anymore?
I'll be happy to help if only I knew where to start, if somebody in the team tells me if this is a documentation issue or an underlying problem in the codebase...

Or at least block the stalebot from constantly pressing, at least I have email notifications active 😅

@milkmaker milkmaker removed the stale Please update the issue with current status, unclear if it's still open/needed. label Feb 26, 2022
@MAGICCC MAGICCC added the neverstale Bot doesn't mark the issue or PR as stale label Feb 27, 2022
@MAGICCC
Copy link
Member

MAGICCC commented Feb 27, 2022

Or at least block the stalebot from constantly pressing, at least I have email notifications active 😅

done :)

@hobbsAU
Copy link

hobbsAU commented Jul 10, 2022

As of docker compose 2.x you must use square brackets [ ] around IPv6 addresses.

The following shows custom IPv4 and IPv6 bindings and works with docker compose 2.x.

mailcow.conf

# Bind services to IPv4 1.2.3.4

SMTP_PORT=1.2.3.4:25
SMTPS_PORT=1.2.3.4:465
SUBMISSION_PORT=1.2.3.4:587

docker-compose.override.yml

# Bind services to IPv6 aaaa:bbbb:cccc:dddd::1

version: '3.8'
services:
  postfix-mailcow:
    ports:
      - "[aaaa:bbbb:cccc:dddd::1]:25:25"
      - "[aaaa:bbbb:cccc:dddd::1]:465:465"
      - "[aaaa:bbbb:cccc:dddd::1]:587:587"

@tschlienger
Copy link

Have there been any news to this? I just installed mailcow on a fresh machine with both a single ipv4 and a single ipv6 address.
When checking outgoing mails the ipv4 address is used by default, so I tried creating the docker-compose.override.yml file according to the documentation in order to use ipv6, however now I'm getting the issue "address already in use" for containers dovecot, postfix and nginx. Netstat doesn't output any of the ports as "in use".

@cyrius
Copy link

cyrius commented Jun 16, 2024

As of docker compose 2.x you must use square brackets [ ] around IPv6 addresses.

The following shows custom IPv4 and IPv6 bindings and works with docker compose 2.x.

mailcow.conf

# Bind services to IPv4 1.2.3.4

SMTP_PORT=1.2.3.4:25
SMTPS_PORT=1.2.3.4:465
SUBMISSION_PORT=1.2.3.4:587

docker-compose.override.yml

# Bind services to IPv6 aaaa:bbbb:cccc:dddd::1

version: '3.8'
services:
  postfix-mailcow:
    ports:
      - "[aaaa:bbbb:cccc:dddd::1]:25:25"
      - "[aaaa:bbbb:cccc:dddd::1]:465:465"
      - "[aaaa:bbbb:cccc:dddd::1]:587:587"

This worked for me.
I addes my ipv4 beofre each port on mailcow.conf and then added the ipv6 in the override

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug neverstale Bot doesn't mark the issue or PR as stale
Projects
None yet
Development

No branches or pull requests