Commit 83405c45 authored by Alex Bennée's avatar Alex Bennée
Browse files

docker: docker.py use "version" to probe usage



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: default avatarAlex Bennée <alex.bennee@linaro.org>
parent 1a7fab92
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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: