Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop printer after containers where stopped by SIGTERM #8610

Closed
wants to merge 1 commit into from

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Sep 13, 2021

When compose is ran attached by compose up, and user interrupt by Ctrl+C, the log printer is not notified about container termination and compose is stuck waiting.

This PR run watchContainers with a background context so it won't get canceled by the top level signal management (see cmd/compose.go#AdaptCmd). Doing so, the logPrinter will recieve ContainerExit events after stop sequence has started, and detect application is down to terminate with adequate exitcode

How to test:

  1. Run compose app with docker compose up
services:
  web:
    image: nginx
  1. Hit Ctrl+C
  2. See notification for container being "Stopped", but still compose command doesn't exit

@ndeloof ndeloof force-pushed the stop_on_cancel branch 3 times, most recently from 6af0eac to 78bc159 Compare September 13, 2021 12:23
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
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.

None yet

1 participant