Using hestiacp managed email in docker container (same server)?

I’m having trouble whenever I try to use a docker container for/with a HestiaCP domain (inclduing adding the corresponding .tpl/.stpl with proxy_pass to the port,….) that I can not use email functionality in that container when I try to use a HestiaCP managed email address.

So I have everything on the same machine (Debian 12)

  • HestiaCP
  • Docker Container
  • HestiaCP managed domain using proxy template to reach the docker container

For example:
I use a paperless-ngx docker container with the added domain paperless.mydomain.com in HestiaCP and now I try to add my HestiaCP added email credentials in the paperless web ui.

[email protected] with mail.mydomain.com (IMAP, STARTLS with port 143)

This doesn’t work at all!

Looks like the docker container can’t access the mail server outside the container on the same server (e.g. mail.mydomain.com)

I’ve tried to add

...
  networks:
    - paperless-net

networks:
  paperless-net:
    driver: bridge

And use host.docker.internal or 172.17.0.1 as imap server (instead of mail.mydomain.com) but nothing worked until now.

Any other tipps I can test?

Thanks

P.S.: When I use credentials for emails outside of my own HestiaCP managed email adresses it works.

Ok, I think the root cause of the problem was simply a missing ACCEPT rule in the firewall for the docker container.

docker network inspect paperless_internal
(changed from bridged to networks: -internal)
showed me that this conatiner uses the “Subnet”: “172.23.0.0/16” so I’ve added this to the HestiaCP firewall

image

Now I was able to add my mail adress directly in the paperless web ui (with server mail.mydomain.com) :+1:

2 Likes