Skip to content

Breaking change in 29.0.0: ExposedPorts can no longer contain port ranges #51537

@felixfontein

Description

@felixfontein

Description

In 28.x and before, one entry in ExposedPorts (of type nat.PortSet, https://github.com/docker/go-connections/blob/main/nat/nat.go) was alloewd to be a range, like 9010-9050 or 9010-9050/tcp.

That type has been replaced in #50710 with a new type PortSet (later moved in #51094) that does not allow a range:

type Port struct {
	num   uint16
	proto unique.Handle[NetworkProtocol]
}

This now results in API calls to create a container with an exposed port 9010-9050 to fail with invalid JSON: invalid port '9010-9050': invalid syntax.

Since I cannot find any mention of this, I'm filing this as a bug. Please point me to a deprecation in case this was an intended change, and not an unintended breaking change.

(The CLI converts ranges for ExposedPorts into a list of single ports, so it's not affected by this. This "only" affects third-party API users.)

CC @austinvazquez since you implemented the changes.

Reproduce

Create a container with the API with ExposedPorts set to ["9010-9050"].

Expected behavior

No response

docker version

Client: Docker Engine - Community
 Version:           29.0.1
 API version:       1.52
 Go version:        go1.25.4
 Git commit:        eedd969
 Built:             Fri Nov 14 16:20:36 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.0.1
  API version:      1.52 (minimum version 1.44)
  Go version:       go1.25.4
  Git commit:       198b5e3
  Built:            Fri Nov 14 16:17:26 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.1.5
  GitCommit:        fcd43222d6b07379a4be9786bda52438f0dd16a1
 runc:
  Version:          1.3.3
  GitCommit:        v1.3.3-0-gd842d771
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    29.0.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.30.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.40.3
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 1
 Server Version: 29.0.1
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: json-file
 Cgroup Driver: systemd
 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
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: fcd43222d6b07379a4be9786bda52438f0dd16a1
 runc version: v1.3.3-0-gd842d771
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.12.0-124.9.1.el10_1.x86_64
 Operating System: Red Hat Enterprise Linux 10.0 (Coughlan)
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.47GiB
 Name: ip-192-168-0-136.ec2.internal
 ID: b23438a2-6b14-435b-84af-ba741e2774f5
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
  ::1/128
 Live Restore Enabled: false
 Firewall Backend: iptables

Additional Info

No response

Metadata

Metadata

Assignees

Labels

area/apiAPIkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.status/0-triageversion/29.0

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions