fix(core): Stop container when signals captured
The current atexit hook that stops (and optionally remove) containers in the Docker daemon would not work because of limitations of the atexit module: the handlers are not executed if the Python interpreter is
killed by a signal not handled by Python, when a Python fatal internal error is detected, or when os._exit() is called. https://docs.python.org/3/library/atexit.html
To handle shutdowns of containers completely (for e.g. when the tests are terminated via SIGINT / SIGTERM), we'd need to register signal handlers for them as well.
This kind of acts as an interim solution while #314 is being implemented.
This issue will be resolved when https://github.com/testcontainers/testcontainers-python/pull/314 lands, which removes the atexit hook completely and removes the dependency on GC to cleanup danglings containers
going to close since reaper v1 has landed, and even reaper v2 (only difference being auto_remove=True (aka docker run --rm) so the instances dont hang out and haunt your system :ghost:)
if any other issues with stopping containers or anything else, just give a shout! @lamcw