fix(agent): Add check for Linux container support to `is_docker_available`
parent
632686cfa5
commit
bca50310f6
|
@ -44,14 +44,15 @@ def we_are_running_in_a_docker_container() -> bool:
|
||||||
|
|
||||||
|
|
||||||
def is_docker_available() -> bool:
|
def is_docker_available() -> bool:
|
||||||
"""Check if Docker is available
|
"""Check if Docker is available and supports Linux containers
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True if Docker is available, False otherwise"""
|
bool: True if Docker is available and supports Linux containers, False otherwise
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
client = docker.from_env()
|
client = docker.from_env()
|
||||||
client.ping()
|
docker_info = client.info()
|
||||||
return True
|
return docker_info["OSType"] == "linux"
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue