Skip to content

consolidate ps behavior between podman ps and podman pod ps #28727

@danishprakash

Description

@danishprakash

podman ps applies a default "running" filter and by default prints a list of running containers. This is said to have been done for Docker compat:

podman/pkg/ps/ps.go

Lines 55 to 66 in 90f38bc

// Docker thinks that if status is given as an input, then we should override
// the all setting and always deal with all containers.
if len(options.Filters["status"]) > 0 {
all = true
}
if !all {
runningOnly, err := filters.GenerateContainerFilterFuncs("status", []string{define.ContainerStateRunning.String()}, runtime)
if err != nil {
return nil, err
}
filterFuncs = append(filterFuncs, runningOnly)
}

Whereas podman pod ps has no such filter and so, by default, it prints a list of pods in any state.

It might be worthwhile to have the same behavior for both. Docker doesn't have pods, so there's no 1-1 compat and perhaps that's the reason for the inconsistency.

Follows from #28707

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