aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Reinier van der Leer <pwuts@agpt.co> 2024-03-20 21:37:56 +0100
committerGravatar Reinier van der Leer <pwuts@agpt.co> 2024-03-20 21:46:09 +0100
commitbca50310f65adea70f31b1c3f7a3aa95c618149d (patch)
treef8d90215f3d28d84e924034039a378b146e82fba
parentfix(agent): Replace `PromptToolkit` with `click.prompt` (diff)
downloadAuto-GPT-bca50310f65adea70f31b1c3f7a3aa95c618149d.tar.gz
Auto-GPT-bca50310f65adea70f31b1c3f7a3aa95c618149d.tar.bz2
Auto-GPT-bca50310f65adea70f31b1c3f7a3aa95c618149d.zip
fix(agent): Add check for Linux container support to `is_docker_available`
-rw-r--r--autogpts/autogpt/autogpt/commands/execute_code.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/autogpts/autogpt/autogpt/commands/execute_code.py b/autogpts/autogpt/autogpt/commands/execute_code.py
index 6aaa4b631..a0ef57179 100644
--- a/autogpts/autogpt/autogpt/commands/execute_code.py
+++ b/autogpts/autogpt/autogpt/commands/execute_code.py
@@ -44,14 +44,15 @@ def we_are_running_in_a_docker_container() -> bool:
def is_docker_available() -> bool:
- """Check if Docker is available
+ """Check if Docker is available and supports Linux containers
Returns:
- bool: True if Docker is available, False otherwise"""
+ bool: True if Docker is available and supports Linux containers, False otherwise
+ """
try:
client = docker.from_env()
- client.ping()
- return True
+ docker_info = client.info()
+ return docker_info["OSType"] == "linux"
except Exception:
return False