

I’ve tried commenting out the ports in the compose file, which should make them only available on the internal network, I thought. But when I do that, the containers can no longer connect to each other.
Did you create an explicit network for them to talk on? Otherwise the default docker network doesn’t support internal DNS queries.
https://docs.docker.com/engine/network/#container-networks
Specifically you need a network using the bridge driver: https://docs.docker.com/engine/network/drivers/bridge/
If it was a certificate issue I’d expect youd just get an error from your browser saying the cert is invalid or expired.
If I had to guess though you’re running into a nat reflection issue: https://nordvpn.com/cybersecurity/glossary/nat-loopback/
Read up on that. But you may need to provide different DNS entries if you’re inside or outside your LAN or add a NAT hairpin rule to your router. But this is only applicable if you’re exposing the same service to the WWW.
Some other things to try though: