From 83405c4517679722257b1560f75fb7488b671374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Mon, 18 Jun 2018 11:14:40 +0100 Subject: docker: docker.py use "version" to probe usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/docker/docker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/docker/docker.py') diff --git a/tests/docker/docker.py b/tests/docker/docker.py index b28ad87034..e6437d64a7 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -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: -- cgit v1.2.3