Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions bldr/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ def get_exit_code(self) -> int:
return self._client.api.inspect_container(self._container.id)['State'].get('ExitCode', 0)

def __exit__(self, exc_type, exc_val, exc_tb) -> None:
force_remove = False
try:
self._container.kill()
except APIError:
pass
except APIError as error:
force_remove = True
self._logger.error(f"Failed to kill container; {error=}")
finally:
self._container.remove()
self._container.remove(force=force_remove)
Loading