Skip to content

[BUG] ps errors out when any of the arguments is a non created but valid container name #9951

@nocive

Description

@nocive

Description

The ps command errors out if you pass it a valid project container name that has not been created yet.
Furthermore, it will stop the ps command from showing any output at all, even if some of the other arguments are valid and have been created.

Perhaps this is intended behavior, but to me it feels counter intuitive.

I know created but not started containers show up as "created" in the ps command, so perhaps we can have a "not created" status shown for these cases and still allow ps to return the output?

Steps To Reproduce

  1. With this project file
services:
  hello-world-a:
    image: hello-world
  hello-world-b:
    image: hello-world
  1. Run: docker compose up -d hello-world-a
[+] Running 1/1
 ⠿ Container dcompose-repro-hello-world-a-1  Started
  1. Run: docker compose ps hello-world-a hello-world-b
no such service: hello-world-b

Compose Version

Docker Compose version v2.12.2

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.9.1)
  compose: Docker Compose (Docker Inc., v2.12.2)
  scan: Docker Scan (Docker Inc., v0.1.0-227-g061fe0a0c5)

Server:
 Containers: 124
  Running: 1
  Paused: 0
  Stopped: 123
 Images: 90
 Server Version: 20.10.20
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
  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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 96df0994faabc1944fc614e52b0b3c6feb609a57.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.18.1-arch1-1
 Operating System: xxx
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.49GiB
 Name: xxx
 ID: xxx
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: xxx
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions