fix: ignore one-off container exit events in monitor by waterWang · Pull Request #14021 · docker/compose · GitHub
Skip to content

fix: ignore one-off container exit events in monitor - #14021

Closed
waterWang wants to merge 1 commit into
docker:mainfrom
waterWang:fix/ignore-oneoff-container-events
Closed

waterWang wants to merge 1 commit into
docker:mainfrom
waterWang:fix/ignore-oneoff-container-events

Conversation

@waterWang

Copy link
Copy Markdown

Description

Fixes #14020

Since 2.39.0, the new monitor.go refactoring introduced a regression where docker compose up --abort-on-container-exit tears down the project when an unrelated one-off container created by docker compose run exits.

Root cause: The ContainerList call in monitor.Start() correctly excludes one-off containers via oneOffFilter(false), but the event subscription (Events()) does not. One-off containers carry com.docker.compose.oneoff=True and pass through the service guard, causing the monitor to see their exit and abort the project.

Fix: Add oneOffFilter(false) to the Events() filter args, matching the ContainerList filter. This is consistent with docker/compose-cli#1987 which established this exclusion deliberately.

Verification

  • docker compose up --abort-on-container-exit main + docker compose run --rm main true no longer triggers premature abort
  • Existing regression: docker compose up --abort-on-container-exit still aborts when a declared service exits (verified independent of this fix)

Related

Add oneOffFilter(false) to the Events subscription in monitor.Start()
to exclude one-off containers created by `docker compose run` from
triggering abort-on-container-exit.

The initial container list (ContainerList) already excludes one-offs,
but the event subscription didn't, causing one-off containers that exit
to tear down the entire compose project.

Fixes docker#14020
@waterWang
waterWang requested review from a team as code owners August 10, 2026 14:13
@waterWang
waterWang requested review from glours and ndeloof August 10, 2026 14:13
@brano-osif

Copy link
Copy Markdown
Contributor

@ndeloof

ndeloof commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

LGTM, but please signoff your commit (this is a legal requirement)

@ndeloof
ndeloof enabled auto-merge (rebase) August 10, 2026 16:00
@brano-osif

Copy link
Copy Markdown
Contributor

Hi @ndeloof
DCO is still failing, and I doubt the author will come back to it (100 PRs across unrelated repos in the last two days, no force-pushes on any). I have the fix signed off on my side, with a regression test. Happy to open a PR to supersede this one.

@ndeloof

ndeloof commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@ndeloof ndeloof closed this Aug 12, 2026
auto-merge was automatically disabled August 12, 2026 13:50

Pull request was closed

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.

[BUG] up --abort-on-container-exit aborts on one-off compose run containers (regression in 2.39.0)

3 participants