pks devcontainer list

stable

Show managed devcontainers with status, volumes, image, and creation time, on this machine or a registered SSH target, as a table or JSON.

Author: Poul Kjeldager
Usage: pks devcontainer list [options]
Category: infrastructure

Examples

$ pks devcontainer list

List running managed devcontainers

$ pks devcontainer list --all

Include stopped containers

$ pks devcontainer list --format json

Emit machine-readable output

pks devcontainer list shows the devcontainers pks manages — containers carrying the pks devcontainer Docker labels — with their status, associated volumes, creation time, and image. Only running containers are shown by default.

It reads Docker on the local machine, or on a registered SSH target when you pick one from the host prompt.

Synopsis

pks devcontainer list [options]

Prerequisites

  • Docker running on the machine being listed.
  • A registered SSH target, only when listing a remote host. Targets are registered with pks ssh.

List containers

pks devcontainer list

The command prints a table of running managed devcontainers. Add stopped ones:

pks devcontainer list --all

For scripting, switch the output format:

pks devcontainer list --all --format json

JSON output is an array. Zero matches print [], so a consumer does not need a special case for an empty result.

Verify

pks devcontainer list --format json

Every container you spawned with pks devcontainer spawn appears in the output, each with the volume that backs it.

Options

FlagDefaultDescription
--all|-afalseShow all containers, not only running ones.
--format <FORMAT>tableOutput format: table or json.
-o|--output-path <PATH>Inherited. Not read by this command.
-v|--verbosefalseInherited. Not read by this command.
-f|--forcefalseInherited. Not read by this command.
--dry-runfalseInherited. Not read by this command.

Troubleshooting

The command asks Which host? every time. When SSH targets are registered, the host picker always runs and offers Local plus each target. There is no flag to preselect a host for list, which makes it awkward to script on a machine with registered targets. spawn --ssh-target and connect --remote do accept a host non-interactively.

No host prompt appears even though targets exist. Remote listing depends on optional SSH services being available. When they are not, the picker is skipped and only local containers are shown.

An invalid --format value errors out. Anything other than table or json fails immediately rather than falling back to the default.

A container you expected is missing. It is either stopped — add --all — or it does not carry the pks devcontainer labels, in which case this command does not manage it.

See also