]> git.proxmox.com Git - mirror_qemu.git/commitdiff
docker: docker.py use "version" to probe usage
authorAlex Bennée <alex.bennee@linaro.org>
Mon, 18 Jun 2018 10:14:40 +0000 (11:14 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Wed, 20 Jun 2018 21:13:39 +0000 (22:13 +0100)
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>
tests/docker/docker.py

index b28ad870345b6fee2a92f3db70ef5c7a85ae7ca1..e6437d64a7db3212ef041e236b4d8c1a9261b1bd 100755 (executable)
@@ -52,7 +52,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: