You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are developing an IDE integration where users can run their applications via a specific service defined in compose.yml. To correctly capture and display the exit code of the target application in the IDE terminal, we start the application using the following command:
docker compose up --exit-code-from <app-service> <app-service>
The Problem
The --exit-code-from flag implicitly enables --abort-on-container-exit. This causes unintended behavior when the target <app-service> relies on other utility or one-off containers (e.g., linters, database migrations, log collectors, or user exploration sessions).
When one of these dependency containers exits, the implicit --abort-on-container-exit triggers and shuts down the entire stack—including the still-running primary application. This happens regardless of the dependency's exit status. Whether a migration finishes successfully, a linter fails, or a user runs an incorrect custom command in an exploratory container, the primary app is unexpectedly killed.
Workarounds Considered
We considered bypassing --exit-code-from entirely by splitting the execution into multiple commands:
docker compose up -d <app-service>
docker compose logs --follow <app-service>
docker compose down <app-service> (triggered when stopping the application from the terminal)
While this is technically doable, managing multiple asynchronous calls makes the IDE implementation significantly more convoluted and introduces potential race conditions.
Questions
Is this strict abort behavior intended when dependency containers exit, regardless of their exit code or purpose? I would love to understand the design logic behind this.
Are there any recommended, cleaner alternatives to capture the target service's exit code without triggering a full stack teardown when side-services exit?
Context
We are developing an IDE integration where users can run their applications via a specific service defined in compose.yml. To correctly capture and display the exit code of the target application in the IDE terminal, we start the application using the following command:
The Problem
The
--exit-code-fromflag implicitly enables--abort-on-container-exit. This causes unintended behavior when the target<app-service>relies on other utility or one-off containers (e.g., linters, database migrations, log collectors, or user exploration sessions).When one of these dependency containers exits, the implicit
--abort-on-container-exittriggers and shuts down the entire stack—including the still-running primary application. This happens regardless of the dependency's exit status. Whether a migration finishes successfully, a linter fails, or a user runs an incorrect custom command in an exploratory container, the primary app is unexpectedly killed.Workarounds Considered
We considered bypassing
--exit-code-fromentirely by splitting the execution into multiple commands:docker compose up -d <app-service>docker compose logs --follow <app-service>docker compose down <app-service>(triggered when stopping the application from the terminal)While this is technically doable, managing multiple asynchronous calls makes the IDE implementation significantly more convoluted and introduces potential race conditions.
Questions
Screen.Recording.2026-05-20.at.19.00.22.mov
Thank you for your time and insights!