diff mbox series

[PULL,50/56] docker: docker.py use "version" to probe usage

Message ID 20180619154435.18898-51-alex.bennee@linaro.org
State Superseded
Headers show
Series add check-tcg and associated machinery | expand

Commit Message

Alex Bennée June 19, 2018, 3:44 p.m. UTC
The "images" command is a fairly heavyweight command to run as it
involves searching the whole docker file-system inventory. On a
machine with a lot of images this makes start-up fairly expensive.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


---
v8
  - use version instead of ps, add comment

-- 
2.17.1
diff mbox series

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index c83fd89985..e6685f6d81 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -49,7 +49,9 @@  def _guess_docker_command():
     commands = [["docker"], ["sudo", "-n", "docker"]]
     for cmd in commands:
         try:
-            if subprocess.call(cmd + ["images"],
+            # docker version will return the client details in stdout
+            # but still report a status of 1 if it can't contact the daemon
+            if subprocess.call(cmd + ["version"],
                                stdout=DEVNULL, stderr=DEVNULL) == 0:
                 return cmd
         except OSError: