Skip to content

feat(compose): add project listing with compose ls - #5286

Open
Mistyheart wants to merge 2 commits into
containerd:mainfrom
Mistyheart:feat/compose-ls
Open

Mistyheart wants to merge 2 commits into
containerd:mainfrom
Mistyheart:feat/compose-ls

Conversation

@Mistyheart

@Mistyheart Mistyheart commented Oct 22, 2026 •

Copy link
Copy Markdown

Add nerdctl compose ls so projects can be listed without locating or loading their Compose files. The command reads Compose labels in the selected containerd namespace, groups container states, and supports --all, --quiet, table/JSON output, and name filters.

Fixes #5285. Related to #3867.

Newly created Compose containers record their configuration-file paths. Existing containers without that label remain listable and display N/A.

The branch has been rebased onto current main. Integration coverage now exercises the command against real containerd containers:

  • Running projects are listed without a Compose file, even when COMPOSE_FILE points to a missing file.
  • --all includes created projects, with the expected container counts and configuration paths.
  • Name filters and sorted, names-only output work.
  • Stopped projects are hidden by default and show exited(1) with --all.

Validation:

  • Windows: project-listing unit tests and go test ./pkg/composer ./pkg/labels -count=1 passed. The labels package has no test files.
  • Linux: an amd64 test binary was cross-compiled on Windows and run in an isolated WSL2 environment with containerd 2.3.7 and runc 1.4.3. The project-listing unit tests and all six new integration subtests passed. The integration tests use private containerd namespaces and clean up their projects.
  • go vet ./cmd/nerdctl/compose ./pkg/composer ./pkg/labels passed on Windows.
  • Targeted golangci-lint for the changed Compose package passed with Linux selected as the target OS.

The local validation is rootful Linux; rootless and FreeBSD validation remain covered by the project's CI. Earlier integration failures involved external image-download limits and a FreeBSD VM download timeout; those failures have not been treated as passing local tests.

AI tools assisted with implementation, tests, and this description.

@Mistyheart

Copy link
Copy Markdown
Author

CI follow-up: the cross-platform unit and Go lint jobs passed. Several integration failures occur while fetching test images: TestRunWithNoSystemd and TestContainerInspectUser encounter 429 Too Many Requests / Data limit exceeded from public.ecr.aws. The FreeBSD job stops before tests while downloading its VM image with an HTTP timeout.

Example logs:

Could the affected jobs be retried when the download failures have cleared? I have not changed the test infrastructure in this PR.

Signed-off-by: 石丰毓 <114632971+Mistyheart@users.noreply.github.com>
Signed-off-by: 石丰毓 <114632971+Mistyheart@users.noreply.github.com>
@Mistyheart
Mistyheart marked this pull request as ready for review November 6, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support listing Compose projects with nerdctl compose ls

1 participant