List container health checks and current status
Build a paste-ready command, then review its compatibility and effects before running it.
docker ps --format '{{.Names}}' | xargs -r docker inspect --format '{{.Name}} {{if .State.Health}}{{.State.Health.Status}}<else>no-healthcheck<end>'Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
Linux + macOS + WindowsVerified for Linux, macOS, Windows using bash, zsh, powershell syntax.
Operational knowledgereview due 2027-01-20
Requirementsdockerdocker must be installed and available on PATH.
Version supportdocker Current supported releasesVerified for linux, macos, windows using bash, zsh, powershell syntax; consult compatibility notes for platform-specific differences.
Expected signals/api healthyRepresentative successful output; values vary with the selected target and system state.
Known errorsdocker: command not founddocker is missing or is not available on PATH.
Verifydocker ps --format '{{.Names}}' | xargs -r docker inspect --format '{{.Name}} {{if .State.Health}}{{.State.Health.Status}}{{else}}no-healthcheck{{end}}'The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01dockerCommandRuns the docker stage of this one-liner.
02psArgumentPasses ps to docker.
03--formatOptionFormats each result using the supplied template.
04'{{.Names}}'ArgumentPasses '{{.Names}}' to docker.
05|PipelinePasses the output on the left to the command on the right.
06xargsCommandRuns the xargs stage of this one-liner.
07-rOptionEnables raw, recursive, or reverse mode for this command.
08dockerArgumentPasses docker to xargs.
09inspectArgumentPasses inspect to xargs.
10--formatOptionFormats each result using the supplied template.
11'{{.Name}} {{if .State.Health}}{{.State.Health.Status}}<else>no-healthcheck<end>'ParameterA value supplied in the Fill parameters section.
Example input
docker ps --format '{{.Names}}' | xargs -r docker inspect --format '{{.Name}} {{if .State.Health}}{{.State.Health.Status}}sample-elseno-healthchecksample-end'
Example output
/api healthy
/worker no-healthcheck
Illustrative output — exact values vary by system and data.
Official sources