Skip to content

fix(compose): return when logs has no matching containers - #5299

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
immanuwell:fix/compose-logs-empty-containers
Nov 15, 2026
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
immanuwell:fix/compose-logs-empty-containers

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

compose logs gets stuck when no containers match, e.g. before the first compose up or after compose down. Return early for an empty list, like Docker does.

Repro with a running containerd, no image pull needed:

repro_dir=$(mktemp -d)
cat > "$repro_dir/compose.yaml" <<'EOF'
services:
  app:
    image: busybox:1.37.0
EOF
nerdctl compose -f "$repro_dir/compose.yaml" -p "logs-repro-$$" logs

Current main hangs. With this fix it exits 0; same for logs -f.

Verified: four CLI cases on containerd and Docker, existing-container logs/follow/tail, make test, affected-package lint. Full lint reports an existing gci error in container_list.go:112.

An empty container list leaves compose logs waiting for an EOF event
that cannot arrive. Return success immediately, matching Docker, and
cover both log modes with and without an explicit service.

Signed-off-by: Immanuel Tikhonov <pchpr.00@list.ru>
@AkihiroSuda AkihiroSuda added this to the v2.5.0 (tentative) milestone Nov 2, 2026

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda
AkihiroSuda merged commit 67e27ab into containerd:main Nov 15, 2026
73 of 92 checks passed
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.

2 participants