Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Catch one more docker error if docker isn't running (#257)

Kilian Lieretfa12472c1152
diff --git a/sweagent/environment/utils.py b/sweagent/environment/utils.py
index 4dd3c36c..c973dd93 100644
--- a/sweagent/environment/utils.py
+++ b/sweagent/environment/utils.py
@@ -354,7 +354,12 @@ def get_container(ctr_name: str, image_name: str, persistent: bool = False) -> T
try:
client = docker.from_env()
except docker.errors.DockerException as e:
- if "connection aborted" in str(e).lower() or "connection refused" in str(e).lower():
+ docker_not_runnnig = any((
+ "connection aborted" in str(e).lower(),
+ "connection refused" in str(e).lower(),
+ "error while fetching server api version" in str(e).lower(),
+ ))
+ if docker_not_runnnig:
msg = (
"Probably the Docker daemon is not running. Please start the Docker daemon and try again. "
"You might need to allow the use of the docker socket "