Skip to content

fix: report RUNNING for stacks with clean-exit init containers (#806)#950

Open
Ninjona wants to merge 1 commit intolouislam:masterfrom
Ninjona:master
Open

fix: report RUNNING for stacks with clean-exit init containers (#806)#950
Ninjona wants to merge 1 commit intolouislam:masterfrom
Ninjona:master

Conversation

@Ninjona
Copy link
Copy Markdown

@Ninjona Ninjona commented Apr 19, 2026

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/dockge/blob/master/CONTRIBUTING.md

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Fixes #806

docker compose ls reports "exited(N), running(M)" when init containers finish cleanly while other services keep running. The existing statusConvert() mapped any "exited" substring to EXITED, so these healthy stacks showed as stopped in the UI.

When statusConvert() yields EXITED but the raw status also mentions running, the new resolveComposeStatus() helper inspects the individual containers via docker ps and upgrades the stack to RUNNING only if every exited container returned exit code 0 and at least one container is still running. All other mixed / non-zero cases continue to report EXITED.

Verified end-to-end with a real compose stack using depends_on: { condition: service_completed_successfully }.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generate no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots

Before (upstream) — stack mis-reported as Exited despite main running:

Upstream: stack badge shows 'exited' even though main container is running

After (this fix) — same stack correctly shown as Active:

Patched: stack badge shows 'active' when init exited cleanly and main is running

Negative case — init exits non-zero, stack still reports Exited:

Patched: stack correctly remains 'exited' when init exits with non-zero code

…lam#806)

docker compose ls reports "exited(N), running(M)" when init containers
finish while other services run. statusConvert mapped any "exited" to
EXITED, hiding healthy stacks as stopped.

When statusConvert yields EXITED but the raw status also mentions
running, inspect containers via docker ps: if every exited container
returned 0 and at least one is still running, report RUNNING. All other
mixed/exit-nonzero cases still report EXITED.
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.

Docker Stack Shows "Exited" Status Due to One-Time Execution Container

1 participant