Hi @diekuh, I hope you can help me with another problem related to this.
After I have executed your commands (I have to execute them every time the server is restarted), other docker containers from other networks (like 172.19.x.y) on the same host cannot send emails to the email server. $HOSTNAME is used as smtp host.
SMTP Error: Could not connect to SMTP host.
It looks like after your commands above, no connection can be made from other docker networks.