I've been running several containers on the same host using different Docker Compose files without issues until recently. After pulling new images over the weekend and restarting my containers, they've lost the ability to communicate with each other using the host's IP address. This was previously working fine, even for containers on separate networks. For instance, I have Plex and Nginx Proxy Manager (NPM) in one Compose file, while Kiwix and Immich are in others. I'm using a domain to redirect to associated internal IPs, which were functioning normally until this problem arose. Now, I can only connect containers using their Docker IPs, and only if they're in the same Compose file. For example, my friendly URLs for Kiwix and Immich aren't working anymore, and while I tried to adjust networks for NPM and Kiwix, I'm still facing issues like 504 errors. I'd appreciate any suggestions on what might have caused this networking issue and how to fix it!
1 Answer
You should use Docker networks to link your containers instead of relying on the host IP or the dynamic internal Docker IPs. Just reference the container names directly for communication, since Docker handles DNS resolution for you automatically.

How do I do that with NPM? It prompts for an IP when I set up a proxy host. It sees containers on its own network but not across others. If I use host IPs, I know they won't change, but why should I avoid doing that?