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/remove containers from aborted builds #921

Closed
scoplin opened this issue Jan 2, 2018 · 0 comments · Fixed by #922
Closed

Stop/remove containers from aborted builds #921

scoplin opened this issue Jan 2, 2018 · 0 comments · Fixed by #922

Comments

@scoplin
Copy link
Contributor

scoplin commented Jan 2, 2018

Description

When attempting to run a batch-mode dockerized program, it is very useful to use the wait condition to wait for a zero exit status and follow mode on. In my case, this would be for running a local Hadoop program, but it could also be employed for other dockerizable tools.

However, if the build is interrupted by the user with control-C, instead of killing the container, it leaves it running disconnected in the background. This appears to be because the wait condition has not yet been satisfied, and so the stop container logic is not active.

The fix, I think, is to simply move the registration of the shutdown hook ahead of starting any of the containers when in follow mode.

Info

  • d-m-p version : 0.23.0
  • Maven version (mvn -v) : 3.5.2
  • Docker version : 1.12.6
  • If it's a bug, how to reproduce :
  1. Start a container with a wait condition that will not be satisfied quickly and follow mode enabled (docker:run, for example).
  2. Abort the build with control-C.
  3. Observe that the container is not stopped or removed.
scoplin pushed a commit to scoplin/docker-maven-plugin that referenced this issue Jan 2, 2018
Moves the shutdown hook in the StartMojo earlier so that containers that
will be cleaned up even if they haven't been fully started per their
wait conditions.  This is especially likely to occur on aborted builds.
[fixes fabric8io#921]

Signed-off-by: Scott Coplin <[email protected]>
@rhuss rhuss closed this as completed in #922 Jan 5, 2018
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 a pull request may close this issue.

1 participant