Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FIXED JENKINS-37769] Failing to stop containers cleanly, so at least…
… stopping them quickly.
- Loading branch information
Showing
2 changed files
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
0fed7a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason that the docker stop command sends a SIGTERM, waits 10 seconds, then sends a SIGKILL, and allows users to selectively overwrite the timeout value is so that the software running in the container can intercept the SIGTERM signal and do a proper cleanup before exiting. (Close file handles, delete half-finished builds, disconnect from databases, etc.)
By hard-coding a 1s delay you've effectively disabled cleanup routines, or cause them to break.
0fed7a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Image use cases other than chroot (i.e., collection of preinstalled tools) are not handled by
withDockerContainer
. For anything else, use explicitdocker
CLI commands.0fed7a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many CI docker image use cases that have cleanup routines. Most are going to intercept SIGTERM, run cleanup, and exit. None of them can use
docker-workflow-plugin
if cleanup takes longer than 1s because SIGKILL will clobber them while they clean up.