We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c9c6f92 commit cf78b03Copy full SHA for cf78b03
core/testcontainers/core/container.py
@@ -1,4 +1,6 @@
1
+from atexit import register
2
from platform import system
3
+from signal import SIGINT, SIGTERM, signal
4
from socket import socket
5
from typing import TYPE_CHECKING, Optional
6
@@ -196,6 +198,9 @@ def _create_instance(cls) -> "Reaper":
196
198
.with_kwargs(privileged=RYUK_PRIVILEGED)
197
199
.start()
200
)
201
+ register(lambda: Reaper._container.stop())
202
+ signal(SIGINT, lambda _, __: Reaper._container.stop())
203
+ signal(SIGTERM, lambda _, __: Reaper._container.stop())
204
wait_for_logs(Reaper._container, r".* Started!")
205
206
container_host = Reaper._container.get_container_host_ip()
0 commit comments