From 5b844e6c8a722f2f44e934fddc5bdf9be6dccb61 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Thu, 26 Jan 2017 19:17:38 +0100 Subject: [PATCH] issue#1009 --- glances/plugins/glances_docker.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py index 34300750..a90c073d 100644 --- a/glances/plugins/glances_docker.py +++ b/glances/plugins/glances_docker.py @@ -29,6 +29,8 @@ from glances.logger import logger from glances.timer import getTimeSinceLastUpdate from glances.plugins.glances_plugin import GlancesPlugin +from glances.globals import WINDOWS + # Docker-py library (optional and Linux-only) # https://github.com/docker/docker-py try: @@ -109,10 +111,14 @@ class Plugin(GlancesPlugin): return None # Init connection to the Docker API try: - if version is None: - ret = init_docker(base_url='unix://var/run/docker.sock') + if WINDOWS: + url = 'npipe:////./pipe/docker_engine' else: - ret = init_docker(base_url='unix://var/run/docker.sock', + url = 'unix://var/run/docker.sock' + if version is None: + ret = init_docker(base_url=url) + else: + ret = init_docker(base_url=url, version=version) except NameError: # docker lib not found