Closed
Description
Description
When running docker compose ps
, the command only shows one port, even when multiple ports are exposed.
Steps to reproduce the issue:
-
Create the following compose.yaml file:
services: web: image: nginx:latest expose: - '80' - '443' - '8080'
-
Run
docker compose up -d
. -
Run
docker compose ps
.
Describe the results you received:
Actual result of the command:
NAME COMMAND SERVICE STATUS PORTS
docker-web-1 "/docker-entrypoint.…" web running 8080/tcp
Describe the results you expected:
Expected result of the command:
NAME COMMAND SERVICE STATUS PORTS
docker-web-1 "/docker-entrypoint.…" web running 80/tcp, 443/tcp, 8080/tcp
Additional information you deem important (e.g. issue happens only occasionally):
Strangely, the command docker compose ps --format json
displays all exposed ports:
[{"ID":"16ba007b938a15d30b76e1cac670cd6eee68c7290032db481e1aaeb84e7dda34","Name":"docker-web-1","Command":"/docker-entrypoint.sh nginx -g 'daemon off;'","Project":"docker","Service":"web","State":"running","Health":"","ExitCode":0,"Publishers":[{"URL":"","TargetPort":80,"PublishedPort":0,"Protocol":"tcp"},{"URL":"","TargetPort":443,"PublishedPort":0,"Protocol":"tcp"},{"URL":"","TargetPort":8080,"PublishedPort":0,"Protocol":"tcp"}]}]
So the issue only exists with the pretty
format.
Output of docker compose version
:
Docker Compose version v2.4.1
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
compose: Docker Compose (Docker Inc., v2.4.1)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 12
Running: 11
Paused: 0
Stopped: 1
Images: 33
Server Version: 20.10.16
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
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 logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
runc version: v1.1.1-0-g52de29d
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.13.0-44-generic
Operating System: Ubuntu 20.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 31GiB
Name: donatello
ID: LHD4:KEEC:7CN4:AVK6:HGK5:A7EP:A6YQ:G23F:F7UA:GOAP:MLTM:Q62W
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details:
Ubuntu 20.04.