fix: report RUNNING for stacks with clean-exit init containers (#806)#950
Open
Ninjona wants to merge 1 commit intolouislam:masterfrom
Open
fix: report RUNNING for stacks with clean-exit init containers (#806)#950Ninjona wants to merge 1 commit intolouislam:masterfrom
Ninjona wants to merge 1 commit intolouislam:masterfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://github.com/louislam/dockge/blob/master/CONTRIBUTING.md
Tick the checkbox if you understand [x]:
Description
Fixes #806
docker compose lsreports"exited(N), running(M)"when init containers finish cleanly while other services keep running. The existingstatusConvert()mapped any"exited"substring toEXITED, so these healthy stacks showed as stopped in the UI.When
statusConvert()yieldsEXITEDbut the raw status also mentionsrunning, the newresolveComposeStatus()helper inspects the individual containers viadocker psand upgrades the stack toRUNNINGonly if every exited container returned exit code 0 and at least one container is still running. All other mixed / non-zero cases continue to reportEXITED.Verified end-to-end with a real compose stack using
depends_on: { condition: service_completed_successfully }.Type of change
Checklist
Screenshots
Before (upstream) — stack mis-reported as Exited despite
mainrunning:After (this fix) — same stack correctly shown as Active:
Negative case — init exits non-zero, stack still reports Exited: