MCPcopy
hub / github.com/saltstack/salt / check_docker

Function check_docker

tools/testsuite/container_test.py:44–59  ·  view source on GitHub ↗

Check if docker is available and running.

(ctx: Context)

Source from the content-addressed store, hash-verified

42
43
44def check_docker(ctx: Context) -> bool:
45 """
46 Check if docker is available and running.
47 """
48 docker = shutil.which("docker")
49 if not docker:
50 ctx.error("docker command not found in PATH")
51 return False
52
53 # Check if docker daemon is running
54 ret = ctx.run("docker", "info", capture=True, check=False)
55 if ret.returncode != 0:
56 ctx.error("docker daemon is not running")
57 return False
58
59 return True
60
61
62@container_test.command(

Callers 3

setup_containerFunction · 0.85
run_testFunction · 0.85
cleanupFunction · 0.85

Calls 2

errorMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected