On my Linux Host docker containers I’m using following network settings to be able to connect to the host via the gateway IP 172.29.6.254
:
networks:
default:
ipam:
driver: default
config:
- subnet: 172.29.0.0/16
ip_range: 172.29.6.0/24
gateway: 172.29.6.254
I wanted to do the same on my windows host with docker desktop (wsl2). I can ping the gateway, but connections are refused.
I thought it might end up in the wsl2 instance, but I opened a port with nc
inside wsl2 and also can’t connect to that. I can connect to the windows host by host.docker.internal
, but I want to have a fixed IP address and not resolve the hostname.
Network inspect looks exactly the same like on my linux host:
docker network inspect dummy_default
[
{
"Name": "dummy_default",
"Id": "a6fc9cc43abd262be542cea1bd1fef9f271a091bf32248e319664af96525ca4b",
"Created": "2024-09-23T07:02:16.96548837Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.29.0.0/16",
"IPRange": "172.29.6.0/24",
"Gateway": "172.29.6.254"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"c69c0a57820d01116f2db8c4bf4870bce2b1d63743f93c3a6dd9e524f16faccd": {
"Name": "bash",
"EndpointID": "3694c8e65009e1560043a4d92f8809bb3e693eb5fcd8001c4ae7e802214406ad",
"MacAddress": "02:42:ac:1d:06:00",
"IPv4Address": "172.29.6.0/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "dummy",
"com.docker.compose.version": "2.29.1"
}
}
]
Does anyone have some insight why this is not working and how I can debug it?