Skip to content

Regression: Change of behavior in .NetworkSettings.Ports since (v4.42?) - Missing exposed but unbound ports #7742

@rfay

Description

@rfay

Description

In recent versions of Docker Desktop, I think since 4.42, NetworkSettings.Ports has changed behavior with regard to ports that are exposed but not bound to the host.

In Docker Desktop previously, and in all other Docker providers (OrbStack, Colima, Lima, Linux Docker Engine, etc) unbound ports are/were listed in NetworkSettings.Ports. For example, the 11111 and 11112 ports below:

$ docker inspect ddev-d11-web --format '{{json .NetworkSettings.Ports}}' | jq .

{
  "11111/tcp": null,
  "11112/tcp": null,
  "11113/tcp": null,
  "443/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "32774"
    }
  ],
  "80/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "32773"
    }
  ],
  "8025/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "32775"
    }
  ],
  "8080/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "32776"
    }
  ]
}

However, in Docker Desktop latest versions, including 4.44.0, the exposed but unbound ports are no longer included:

$ docker inspect ddev-d11-web --format '{{json .NetworkSettings.Ports}}' | jq .

{
  "443/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "60806"
    }
  ],
  "80/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "60803"
    }
  ],
  "8025/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "60804"
    }
  ],
  "8080/tcp": [
    {
      "HostIp": "127.0.0.1",
      "HostPort": "60805"
    }
  ]
}

The actual docker api doesn't matter; the Docker engine used in colima is even later than Docker Desktop. The only place that has this behavior is Docker Desktop in the last few versions.

I didn't chase this until now because I thought it was the same as

But that's apparently fixed now and this problem remains in 4.44.0

Reproduce

The demonstration is above.

Expected behavior

There was no reason for NetworkSettings.Ports to change, it should still show the unbound ports.

docker version

Client:
 Version:           28.2.2
 API version:       1.50
 Go version:        go1.24.3
 Git commit:        e6534b4
 Built:             Fri May 30 12:07:35 2025
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.44.0 (201307)
 Engine:
  Version:          28.3.2
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.5
  Git commit:       e77ff99
  Built:            Wed Jul  9 16:13:56 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.7.27
  GitCommit:        05044ec0a9a75232cad458027ca83437aae3f4da
 runc:
  Version:          1.2.5
  GitCommit:        v1.2.5-0-g59923ef
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    28.2.2
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.9.11
    Path:     /Users/rfay/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.26.1-desktop.1
    Path:     /Users/rfay/.docker/cli-plugins/docker-buildx
  cloud: Docker Cloud (Docker Inc.)
    Version:  v0.4.11
    Path:     /Users/rfay/.docker/cli-plugins/docker-cloud
  compose: Docker Compose (Docker Inc.)
    Version:  v2.39.1-desktop.1
    Path:     /Users/rfay/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.42
    Path:     /Users/rfay/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  v0.2.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-desktop
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.29
    Path:     /Users/rfay/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-init
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  v0.13.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-mcp
  model: Docker Model Runner (EXPERIMENTAL) (Docker Inc.)
    Version:  v0.1.36
    Path:     /Users/rfay/.docker/cli-plugins/docker-model
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/rfay/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.18.2
    Path:     /Users/rfay/.docker/cli-plugins/docker-scout

Server:
 Containers: 7
  Running: 4
  Paused: 0
  Stopped: 3
 Images: 53
 Server Version: 28.3.2
 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
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Discovered Devices:
  cdi: docker.com/gpu=webgpu
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: v1.2.5-0-g59923ef
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.10.14-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 10
 Total Memory: 5.786GiB
 Name: docker-desktop
 ID: 6f255030-2334-4fab-8b6e-2b8ab058d21a
 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=unix:///Users/rfay/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Diagnostics ID

38E7926F-CA67-4BA5-9C10-F0676D2232CA/20250812222147

Additional Info

This breaks DDEV's ddev describe and thus TestCmdDescribe. The code can be rewritten to get unbound ports from Config.ExposedPorts, but since every other Docker provider (including Linux Docker Engine, and docker engine as bundled in Colima and Orbstack) still does it the same as it has always been, it seems like this is a regression.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions