You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From both windows and other WSL2 distros network traffic can make it's way to the container.
(e.g. visit http://127.0.0.1:1111/ or curl http://127.0.0.1:1111/ - requests will timeout as no response but you can see in the container the traffic reaching it.)
When you bind to any other loopback address... e.g. docker run --rm -it --network host fedora:latest dnf install -y netcat nc -l 127.0.0.2 1111
You can no longer access the application from Windows but can from other WSL2 distributions. This bind is confirmed from the output of a netstat from a different distro:
> netstat -tulpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.255.255.254:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.2:1111 0.0.0.0:* LISTEN -
udp 0 0 10.255.255.254:53 0.0.0.0:* -
udp 0 0 127.0.0.1:323 0.0.0.0:* -
udp6 0 0 ::1:323 :::* -
Through Windows resource monitor you can also confirm that there is no listening port
Expected behavior
The expectation is that the entirety of the IPv4 loopback space is looped back to the Windows host when in network mode host.
It is useful to overload loopback ports by having applications bind to separate IP addresses. For example you may have a 3 member clustering application bind to:
127.20.10.10 port 12345 127.20.10.11 port 12345 127.20.10.12 port 12345
You want your host (Windows/other WSL2) and all the other containers
docker version
Client:
Version: 27.0.3
API version: 1.46
Go version: go1.21.11
Git commit: 7d4bcd8
Built: Sat Jun 29 00:03:32 2024
OS/Arch: windows/amd64
Context: desktop-linux
Server: Docker Desktop 4.32.0 (157355)
Engine:
Version: 27.0.3
API version: 1.46 (minimum version 1.24)
Go version: go1.21.11
Git commit: 662f78c
Built: Sat Jun 29 00:02:50 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.18
GitCommit: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
runc:
Version: 1.7.18
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 27.0.3
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.15.1-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.28.1-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.32
Path: C:\Program Files\Docker\cli-plugins\docker-debug.exe
desktop: Docker Desktop commands (Alpha) (Docker Inc.)
Version: v0.0.14
Path: C:\Program Files\Docker\cli-plugins\docker-desktop.exe
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: C:\Program Files\Docker\cli-plugins\docker-dev.exe
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.25
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.5
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.3.0
Path: C:\Program Files\Docker\cli-plugins\docker-init.exe
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: C:\Program Files\Docker\cli-plugins\docker-sbom.exe
scout: Docker Scout (Docker Inc.)
Version: v1.10.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 3
Server Version: 27.0.3
Storage Driver: overlayfs
driver-type: io.containerd.snapshotter.v1
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e
runc version: v1.1.13-0-g58aa920
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 5.15.153.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 47.05GiB
Name: docker-desktop
ID: 8ac9c384-f1d7-43f7-a04e-5d8b0bb6a064
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=npipe://\\.\pipe\docker_cli
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
Description
Host networking doesn't support forwarding traffic from windows for container-bound addresses in 127.0.0.0/8 other than 127.0.0.1.
Behaviour works as expected from other WSL2 distributions.
Behaviour observed in both mirrored and NAT WSL network modes.
Reproduce
docker run --rm -it --network host fedora:latest
dnf install -y netcat
nc -l 127.0.0.1 1111
From both windows and other WSL2 distros network traffic can make it's way to the container.
(e.g. visit http://127.0.0.1:1111/ or curl http://127.0.0.1:1111/ - requests will timeout as no response but you can see in the container the traffic reaching it.)
When you bind to any other loopback address... e.g.
docker run --rm -it --network host fedora:latest
dnf install -y netcat
nc -l 127.0.0.2 1111
You can no longer access the application from Windows but can from other WSL2 distributions. This bind is confirmed from the output of a netstat from a different distro:
Through Windows resource monitor you can also confirm that there is no listening port
Expected behavior
The expectation is that the entirety of the IPv4 loopback space is looped back to the Windows host when in network mode host.
It is useful to overload loopback ports by having applications bind to separate IP addresses. For example you may have a 3 member clustering application bind to:
127.20.10.10
port12345
127.20.10.11
port12345
127.20.10.12
port12345
You want your host (Windows/other WSL2) and all the other containers
docker version
Client: Version: 27.0.3 API version: 1.46 Go version: go1.21.11 Git commit: 7d4bcd8 Built: Sat Jun 29 00:03:32 2024 OS/Arch: windows/amd64 Context: desktop-linux Server: Docker Desktop 4.32.0 (157355) Engine: Version: 27.0.3 API version: 1.46 (minimum version 1.24) Go version: go1.21.11 Git commit: 662f78c Built: Sat Jun 29 00:02:50 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.18 GitCommit: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e runc: Version: 1.7.18 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Diagnostics ID
N?A
Additional Info
The text was updated successfully, but these errors were encountered: