{"record":{"id":"0bcae20f48429ce3","repo":"nicolargo/glances","slug":"missing-libs-required-to-run-docker-extension-con","errorCode":null,"errorMessage":"Missing libs required to run Docker Extension (Containers) ","messagePattern":"Missing libs required to run Docker Extension \\(Containers\\) ","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"glances/plugins/containers/engines/docker.py","lineNumber":248,"sourceCode":"        old_io_stats = self._old_computed_stats.get(\"io\")\n        if old_io_stats:\n            stats['time_since_update'] = round(self.time_since_update)\n            stats['ior'] = stats['cumulative_ior'] - old_io_stats[\"cumulative_ior\"]\n            stats['iow'] = stats['cumulative_iow'] - old_io_stats[\"cumulative_iow\"]\n\n        # Return the stats\n        return stats\n\n\nclass DockerExtension:\n    \"\"\"Glances' Containers Plugin's Docker Extension unit\"\"\"\n\n    CONTAINER_ACTIVE_STATUS = ['running', 'healthy', 'paused']\n\n    def __init__(self):\n        self.disable = disable_plugin_docker\n        if self.disable:\n            raise Exception(\"Missing libs required to run Docker Extension (Containers) \")\n\n        self.display_error = True\n\n        self.client = None\n        self.ext_name = \"containers (Docker)\"\n        self.stats_fetchers = {}\n\n        # Issue #3559: cache the (immutable) image tags per container id to avoid\n        # one inspect_image API call per container on every refresh.\n        self.image_cache = {}\n\n        self.connect()\n\n    def connect(self) -> None:\n        \"\"\"Connect to the Docker server.\"\"\"\n        # Init the Docker API Client\n        try:\n            # Do not use the timeout option (see issue #1878)","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/plugins/containers/engines/docker.py#L230-L266","documentation":"Raised in the Docker engine's __init__ when the module-level import check (disable_plugin_docker) reports that required libraries are missing. Glances' containers plugin guards optional dependencies this way and refuses to instantiate the Docker engine, raising a bare Exception carrying this message.","triggerScenarios":"Instantiating glances.plugins.containers.engines.docker.DockerGlancesContainerExtension without the docker SDK (or its dependencies) importable, or when a previous import of 'docker' failed and set disable_plugin_docker=True.","commonSituations":"pip install glances without [docker] extras; restricted/embedded environments where the docker package fails to import; dependency downgrades that shadow the docker module.","solutions":["Install the optional deps: pip install 'glances[docker]' (or pip install docker)","Verify with python -c 'import docker' that nothing shadows it and it imports cleanly","Check for a local file/dir named docker.py on sys.path shadowing the SDK","If Docker monitoring is unwanted, disable the containers plugin instead of relying on the crash"],"exampleFix":"# before\n$ pip install glances\n# after\n$ pip install 'glances[docker]'","handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec('docker') is None:\n    raise SystemExit('install: pip install glances[docker]')","typeGuard":"def docker_engine_available() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('docker') is not None","tryCatchPattern":"try:\n    from glances.plugins.containers.engines.docker import DockerGlancesContainerExtension\n    ext = DockerGlancesContainerExtension()\nexcept Exception as e:\n    if 'Missing libs' in str(e):\n        ext = None  # docker monitoring disabled\n    else:\n        raise","preventionTips":["Install extras: pip install 'glances[docker]'","Never name local files docker.py","Disable the containers plugin when Docker stats aren't needed"],"tags":["glances","docker","containers","missing-dependency","import-error"],"backgroundTag":"missing-dependency","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}