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
I have a Docker image with an application running on port 8080. When trying to run the application with network_mode: host, the port is not accessible from the host system. Running the same compose file on Linux works fine.
I am using Docker Desktop v4.30.0 with host networking enabled on Windows 11 Version 10.0.22631 Build 22631.
Observe that the application is not accessible from the host.
Compose Version
`docker compose version`
Docker Compose version v2.27.0-desktop.2
`docker-compose version`
Docker Compose version v2.27.0-desktop.2
Docker Environment
Client:
Version: 26.1.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0-desktop.1
Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.27.0-desktop.2
Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.29
Path: C:\Program Files\Docker\cli-plugins\docker-debug.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.23
Path: C:\Program Files\Docker\cli-plugins\docker-extension.exe
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: C:\Program Files\Docker\cli-plugins\docker-feedback.exe
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.1.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.8.0
Path: C:\Program Files\Docker\cli-plugins\docker-scout.exe
Server:
Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 8
Server Version: 26.1.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
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: e377cd56a71523140ca6ae87e30244719194a521
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.90.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 15.58GiB
Name: docker-desktop
ID: e4c1c101-3b9d-43f5-80f0-66f1ebb06ff8
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: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile
Anything else?
The port 8080 isn't listed when running netstat -aon on the host system.
When execing directly into the container, I can successfuly wget http://localhost:8080 and get a correct HTML page.
Pinging local network machines from the container works, so it seems to be using the host network correctly. The application is also able to connect to the database on localhost:3306.
Same applies to a plain docker run. When network mode is set to host, your container uses the host network interface without any abstraction. When running on Docker Desktop this one is the Virtual machine network interface, not localhost.
Please report this issue on https://github.com/docker/for-mac as this is unrelated to docker compose
Description
I have a Docker image with an application running on port 8080. When trying to run the application with
network_mode: host
, the port is not accessible from the host system. Running the same compose file on Linux works fine.I am using Docker Desktop v4.30.0 with host networking enabled on Windows 11 Version 10.0.22631 Build 22631.
Steps To Reproduce
Tomcat started on port(s): 8080 (http) with context path ''
is visible in the output.Compose Version
Docker Environment
Anything else?
The port 8080 isn't listed when running
netstat -aon
on the host system.When execing directly into the container, I can successfuly
wget http://localhost:8080
and get a correct HTML page.Pinging local network machines from the container works, so it seems to be using the host network correctly. The application is also able to connect to the database on
localhost:3306
.Output of docker inspect
The text was updated successfully, but these errors were encountered: