I'm having a networking issue and could use some help. Here's my setup: I have an Ubuntu Server running Docker (IP: 10.0.0.52) that is not joined to any corporate domain. On my local LAN, I have a database server at IP 10.0.0.8, which is likely part of a Windows domain.
My goal is to connect an application running inside a Docker container to this database at 10.0.0.8. However, I'm encountering connection timeouts or an unreachable error.
I've checked my docker-compose configuration to ensure I'm using the correct connection string with the IP address, since my host doesn't support internal DNS resolution for the domain. I've also tried using the standard bridge network.
I have a few questions:
1. Could the database server be blocking traffic from non-domain IPs, given that my host isn't part of the domain?
2. Do I really need to use `network_mode: host`, or will the default bridge work for outbound traffic to a LAN IP?
3. Are there specific Docker routing rules I need to consider to access a local LAN IP that's outside my Docker subnet?
Any troubleshooting tips or configurations I should check out for this non-domain to domain connection issue would be greatly appreciated!
2 Answers
First, you should test if you can ping the database server's IP from your host. If that's working, you're at least getting some network connectivity going. If you can't ping it, there might be a network issue or the DB server could be blocking traffic from your host's IP.
As for your Docker setup, since the application and DB server are in different networks, referencing by hostname might not work unless they're part of the same Docker network. You need to use the IP directly, which you already did. So keep at it with the IP.
You typically don't need `network_mode: host` for just outbound connections like yours. Docker's default bridge network should suffice. But do check your firewall settings on the server. Sometimes Windows firewalls can block traffic from non-domain machines. Just make sure that the DB server allows inbound connections on the necessary ports from external IPs.
That's super helpful! I’ll double-check the firewall settings on the DB server.

Yep, I can ping the DB server from the host. So, that's a good sign. Thanks for the suggestion!