Skip to content

docker ps sorts IPs lexicographically instead of numerically #7143

Description

@hirehamir

Description

When a container publishes ports on multiple IPs, docker ps orders them by the string form of the IP, so 10.0.0.2 sorts before 9.0.0.1.

Current behavior:

127.0.0.10:8080->80/tcp, 127.0.0.9:8081->80/tcp

Reproduce

docker run -d --name porttest -p 127.0.0.9:8081:80 -p 127.0.0.10:8080:80 nginx:alpine
docker ps

Expected behavior

127.0.0.9:8081->80/tcp, 127.0.0.10:8080->80/tcp

docker version

Client: Docker Engine - Community
 Version:           29.7.1
 API version:       1.55
 Go version:        go1.26.5
 Git commit:        e9452d6
 Built:             Fri Jul 31 17:06:34 2026
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.7.1
  API version:      1.55 (minimum version 1.40)
  Go version:       go1.26.5
  Git commit:       c5b8ce9
  Built:            Fri Jul 31 17:06:34 2026
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.2.6
  GitCommit:        11ce9d5f3c68c941867e82890e93e815c1304f1b
 runc:
  Version:          1.3.6
  GitCommit:        v1.3.6-0-g491b69ba
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    29.7.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.36.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.3.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 27
  Running: 5
  Paused: 0
  Stopped: 22
 Images: 487
 Server Version: 29.7.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: 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: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 11ce9d5f3c68c941867e82890e93e815c1304f1b
 runc version: v1.3.6-0-g491b69ba
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 7.0.0-28-generic
 Operating System: Ubuntu 24.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.28GiB
 Name: ubuntu24
 ID: 866b0a10-227e-4378-9732-c4fdde0aa222
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables
  EnableUserlandProxy: true
  UserlandProxyPath: /usr/bin/docker-proxy

Additional Info

No response

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