Can't connect to localhost using host.docker.internal
See original GitHub issueActual Behavior
Trying to connect to azure mssql within docker container. Bitvise client is running on windows host, bound to all interfaces (0.0.0.0) on port 1435. Trying to access it using tsql
with host parameter host.docker.internal
port 1435 but times out after +/- 2 minutes, bitvise logs show no communication attempts. If i try to connect directly to the database IP address the connection is established but access is denied as per server access rules (IP address not allowed to connect).
Steps to Reproduce
Install Rancher Desktop, updated to 1.2.1.
Built container with net=host
or net=bridge
or not setting it at all
Run:
tsql -H host.docker.internal -p 1435 -U [user] -P [password] -D [database]
tsql -H host.rancher-desktop.internal -p 1435 -U [user] -P [password] -D [database]
tsql -H host.rancher-desktop.internal -p 1435 -U [user] -P [password] -D [database]
tsql -H 127.0.1.1 -p 1435 -U [user] -P [password] -D [database]
WSL2 is used
Result
tsql
times out or refuses to connect.
Expected Behavior
Login to the database server and query databases
Additional Information
Routing info inside Rancher Desktop host
Rancher Desktop Version
1.2.1
Rancher Desktop K8s Version
1.22.7
Which container runtime are you using?
moby (docker cli)
What operating system are you using?
Windows
Operating System / Build Version
Windows 10 Enterprise, build 19044
What CPU architecture are you using?
x64
Linux only: what package format did you use to install Rancher Desktop?
No response
Windows User Only
Custom defined VPN
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:17 (8 by maintainers)
@Nino-K , we already have an FAQ item for this. https://docs.rancherdesktop.io/faq#q-can-containers-reach-back-to-host-services-via-hostdockerinternal
@dougbreaux Thanks for confirming that this was a local config issue. The new firewall rule proposed by @Nino-K seems to fix the problem for everyone who has responded so far.
I’m going to hide your earlier messages as “outdated” to prevent confusing users who find this issue via a Google search.
Please file a separate issue for unrelated problems!
I’ll leave this bug open for now until we have figured out if we want to add the firewall rule to the installer or some other way to make it easier for users to enable it.