Skip to content

Use Docker Compose v2 (docker compose) in the compose log collector#148

Merged
wu-sheng merged 3 commits into
mainfrom
fix/compose-collector-v2
Jun 18, 2026
Merged

Use Docker Compose v2 (docker compose) in the compose log collector#148
wu-sheng merged 3 commits into
mainfrom
fix/compose-collector-v2

Conversation

@wu-sheng

@wu-sheng wu-sheng commented Jun 17, 2026

Copy link
Copy Markdown
Member

Fix docker-compose: command not found in the compose log collector on modern runners

Why now

GitHub deprecated and removed Docker Compose v1 (the standalone docker-compose binary) from its hosted Ubuntu runner images — see the deprecation notice and actions/runner-images#9692. Current ubuntu-latest / ubuntu-24.04 images ship only Docker Compose v2 (docker compose); docker-compose is gone (actions/runner-images#9864). So any workflow on those images hits this in the collector:

docker compose ps failed: … stderr: docker-compose: command not found

(observed in Apache SkyWalking's e2e — container logs were never collected on failures, making CI failures much harder to debug).

Problem

setup already uses Compose v2 (via testcontainers-go/modules/compose); only the log collector still shelled out to v1. internal/constant/compose.go defines ComposeCommand = "docker-compose", used by collector.findComposeContainerdocker-compose -f … -p … ps -q …. It's the only docker-compose reference in the repo, and it's executed via bash -ec.

Fix

-	ComposeCommand = "docker-compose"
+	ComposeCommand = "docker compose"

Run via bash -ec, the two-word v2-plugin invocation works as-is, and v2 accepts the same -f / -p / ps -q flags.

CI coverage (why this wasn't caught — now fixed)

infra-e2e's own e2e (test/e2e/e2e.yaml) runs on ubuntu-latest (no v1) but never exercised the collector — so it neither caught the breakage nor would validate this fix. This PR adds a cleanup.collect config + a verify case that runs e2e collect against the running stack and asserts a container file was gathered. The collector now runs in CI on a v1-less runner — proving it works via docker compose v2 and failing the build if it ever regresses to v1.

Validation (local)

A compose e2e (nginx) and the new httpbin guard, built binary, run with:

  • docker-compose v1 hidden, and a failing docker-compose stub shadowing PATH;

e2e run / e2e collect complete green and the collector gathers inspect.json + a container file via docker compose v2, while the stub is never invoked. The new verify case reports 1 passed.

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. N/A

The compose collector shells out to `docker-compose -f ... -p ... ps -q ...` (Compose
v1) to locate containers for log collection. GitHub-hosted `ubuntu-24.04` runners no
longer ship the standalone `docker-compose` (v1) binary, so collection fails with
`docker-compose: command not found` on every failed e2e (setup already uses Compose v2
via testcontainers-go, so only the collector was still on v1).

Switch `ComposeCommand` from `docker-compose` to `docker compose`. The command is run
via `bash -ec`, so the two-word v2 plugin invocation works as-is, and v2 accepts the
same `-f / -p / ps -q` flags.

Validated locally with a compose e2e (nginx): with `docker-compose` v1 absent (and with
a failing `docker-compose` stub shadowing PATH), `e2e run` completes green and the
collector gathers container files via `docker compose` v2 without ever invoking
`docker-compose`.
@wu-sheng wu-sheng added this to the 1.4.0 milestone Jun 17, 2026
@wu-sheng wu-sheng added the enhancement New feature or request label Jun 17, 2026
infra-e2e's own e2e (`test/e2e/e2e.yaml`) runs on `ubuntu-latest` (which ships only
Docker Compose v2) but never exercised the compose log collector, so the v1->v2
breakage slipped through CI and the prior fix had no regression guard.

Add a `cleanup.collect` config (httpbin / /etc/hostname) and a verify case that runs
`e2e collect` against the already-running stack and asserts a container file was
gathered. The collector now runs in CI on a v1-less runner, proving it works via
`docker compose` v2 and failing the build if it ever regresses to `docker-compose` v1.

Validated locally: `e2e collect` gathers /etc/hostname from the httpbin service and the
verify case reports `1 passed`.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

license-eye has totally checked 400 files.

Valid Invalid Ignored Fixed
97 1 302 0
Click to see the invalid file list
  • test/e2e/collect-expected.yaml

Comment thread test/e2e/collect-expected.yaml
@wu-sheng wu-sheng requested a review from kezhenxu94 June 18, 2026 00:05
@wu-sheng wu-sheng merged commit 68bbdec into main Jun 18, 2026
6 checks passed
@wu-sheng wu-sheng deleted the fix/compose-collector-v2 branch June 18, 2026 00:26
wu-sheng added a commit to apache/skywalking that referenced this pull request Jun 18, 2026
GitHub-hosted runners (ubuntu-24.04) ship only Docker Compose v2 and no
longer provide the legacy docker-compose v1 binary, so the infra-e2e log
collector failed on current runners. Bump the pinned infra-e2e action from
0d91769 to 68bbdec (apache/skywalking-infra-e2e#148), which switches the
collector to 'docker compose', restoring e2e container-log collection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants