u/Dreaddit0r

▲ 0 r/docker

unable to access container's published ports from windows host with internal: true

I have a container running a server with this docker compose:

services:
  container:
    build: .
    container_name: container1

    ports:
      - "127.0.0.1:12345:12345"

    command: >
      sh -c "python server.py --listen 0.0.0.0 --port 12345"

    networks:
      - isolated

networks:
  isolated:
    internal: true

Environment:

- Windows 11,

- Docker Desktop,

- WSL2 backend enabled,

- Docker Desktop WSL integration for my Ubuntu distro is NOT enabled

The server inside the container is confirmed listening on 0.0.0.0:12345

When internal: true is enabled:

- I cannot access 127.0.0.1:12345 from the Windows host

- docker ps shows:

ports

12345/tcp

instead of:

127.0.0.1:12345->12345/tcp

When I remove internal: true, access immediately works and docker ps correctly shows the published port mapping.

Is this expected behavior for internal: true on Docker Desktop/WSL2, or are published host ports supposed to work on internal networks?

reddit.com
u/Dreaddit0r — 10 days ago