{"record":{"id":"a70cdecf6a2bb8f1","repo":"louislam/uptime-kuma","slug":"connection-to-docker-daemon-timed-out","errorCode":null,"errorMessage":"Connection to Docker daemon timed out.","messagePattern":"Connection to Docker daemon timed out\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/docker.js","lineNumber":105,"sourceCode":"        try {\n            let res = await axios.request(options);\n\n            if (Array.isArray(res.data)) {\n                if (res.data.length > 1) {\n                    if (\"ImageID\" in res.data[0]) {\n                        return res.data.length;\n                    } else {\n                        throw new Error(\"Invalid Docker response, is it Docker really a daemon?\");\n                    }\n                } else {\n                    return res.data.length;\n                }\n            } else {\n                throw new Error(\"Invalid Docker response, is it Docker really a daemon?\");\n            }\n        } catch (e) {\n            if (e.code === \"ECONNABORTED\" || e.name === \"CanceledError\") {\n                throw new Error(\"Connection to Docker daemon timed out.\");\n            } else {\n                throw e;\n            }\n        }\n    }\n\n    /**\n     * Since axios 0.27.X, it does not accept `tcp://` protocol.\n     * Change it to `http://` on the fly in order to fix it. (https://github.com/louislam/uptime-kuma/issues/2165)\n     * @param {any} url URL to fix\n     * @returns {any} URL with tcp:// replaced by http://\n     */\n    static patchDockerURL(url) {\n        if (typeof url === \"string\") {\n            // Replace the first occurrence only with g\n            return url.replace(/tcp:\\/\\//g, \"http://\");\n        }\n        return url;","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/docker.js#L87-L123","documentation":"The catch block in testDockerHost inspects the axios error: if e.code === 'ECONNABORTED' or e.name === 'CanceledError' it re-throws as this friendly timeout message. The request has a 5000ms axios timeout and a 6000ms axiosAbortSignal, so the timeout fires at the 5–6 second mark. Any non-timeout axios error is rethrown as-is by the else branch.","triggerScenarios":"The Docker daemon is unreachable (firewall, wrong host, down), or it is reachable but slow to enumerate containers, so the 5s timeout elapses. Socket path present but dockerd not running. TCP host behind a slow proxy. The 6000ms AbortController fires before axios's own timeout.","commonSituations":"Local dockerd stopped; firewall blocking 2375/2376; the daemon is up but on a busy host enumerating hundreds of containers; TLS handshake stalled by a missing/mismatched CA; remote daemon over a high-latency link.","solutions":["Confirm the daemon is running: `systemctl status docker` (Linux) or `docker info`.","From the Uptime Kuma host, time the call directly: `time curl --unix-socket /var/run/docker.sock http://localhost/containers/json?all=true` — if it takes >5s you need to raise the timeout or speed up the daemon.","Open the network path: for TCP, ensure the port is reachable and not filtered; for TLS, confirm the cert files under data/docker-tls/<host>/.","If your environment legitimately needs more time, raise `timeout` and the `axiosAbortSignal` delay in testDockerHost (server/docker.js:71-75)."],"exampleFix":"// before\nconst options = {\n    url: \"/containers/json?all=true\",\n    timeout: 5000,\n    // ...\n    signal: axiosAbortSignal(6000),\n};\n\n// after — give slow daemons a chance\nconst options = {\n    url: \"/containers/json?all=true\",\n    timeout: 15000,\n    // ...\n    signal: axiosAbortSignal(16000),\n};","handlingStrategy":"retry","validationCode":"// Sanity-check reachability and latency before configuring\nasync function probeDockerLatency(options) {\n    const start = Date.now();\n    try {\n        await require(\"axios\").request({ ...options, timeout: 4000 });\n        return Date.now() - start;\n    } catch (e) {\n        if (e.code === \"ECONNABORTED\") return -1;\n        throw e;\n    }\n}","typeGuard":null,"tryCatchPattern":"// Retry transient timeouts before reporting the host as broken\nasync function testWithRetry(host, attempts = 2) {\n    for (let i = 0; i < attempts; i++) {\n        try { return await DockerHost.testDockerHost(host); }\n        catch (e) {\n            if (/timed out/.test(e.message) && i < attempts - 1) continue;\n            throw e;\n        }\n    }\n}","preventionTips":["Ensure dockerd is up and the network path is open before testing the host in the UI.","On high-latency links, raise timeout/abortSignal in testDockerHost to avoid false negatives.","Use the socket transport when possible — it removes a network hop."],"tags":["docker","network","timeout"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}