Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
A solution to prevent zombie containers locally and in CI (#12381)
Browse files Browse the repository at this point in the history
Fix pylint, mypy, and pycharm code inspection warnings
  • Loading branch information
larroy authored and marcoabreu committed Aug 28, 2018
1 parent ae5d60f commit e2a3eef
Show file tree
Hide file tree
Showing 2 changed files with 243 additions and 75 deletions.
14 changes: 14 additions & 0 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ To work inside a container with a shell you can do:
When building, the artifacts are located in the build/ directory in the project root. In case
`build.py -a` is invoked, the artifacts are located in build.<platform>/

# Docker container cleanup (Zombie containers)
Docker has a client-server architecture, so when the program that is executing the docker client
dies or receieves a signal, the container keeps running as it's started by the docker daemon.
We implement signal handlers that catch sigterm and sigint and cleanup containers before exit. In
Jenkins there's not enough time between sigterm and sigkill so we guarantee that containers are not
left running by propagating environment variables used by the Jenkins process tree killer to
identify which process to kill when the job is stopped. This has the effect of stopping the
container given that the process inside the container is terminated.

How to test this is working propperly: On the console you can hit ^C while a container is running
(not just building) and see that the container is stopped by running `docker ps` on another
terminal. In Jenkins this has been tested by stopping the job which has containers running and
verifying that the container stops shortly afterwards by running docker ps.

## Add a platform

To add a platform, you should add the appropriate dockerfile in
Expand Down
Loading

0 comments on commit e2a3eef

Please sign in to comment.