[FIX] Container removal already in progress

fixes #60
This commit is contained in:
Simon Maillard 2024-10-03 09:07:00 +02:00
parent 1f95377efa
commit f649627d63
2 changed files with 7 additions and 2 deletions

View File

@ -131,6 +131,9 @@ def kill_container(container_name):
try:
container.stop()
container.wait()
container.remove()
if container.status != "removed":
container.remove()
container.wait(condition="removed")
except docker.errors.NotFound as err:
logger.debug(f"Cannot kill container {container.name}: {err}")

View File

@ -33,7 +33,9 @@ def get_postgres_container(ctx):
f"Found container {container_name} in a exited status."
" Removing it..."
)
container.remove()
if container.status != "removed":
container.remove()
container.wait(condition="removed")
else:
return container