{"record":{"id":"a9ddc1d616abe4c1","repo":"louislam/dockge","slug":"failed-to-stop-please-check-the-terminal-output-f","errorCode":null,"errorMessage":"Failed to stop, please check the terminal output for more information.","messagePattern":"Failed to stop, please check the terminal output for more information\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"backend/stack.ts","lineNumber":434,"sourceCode":"        }\n        console.log(options);\n        return options;\n    }\n\n    async start(socket: DockgeSocket) {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        let exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", this.getComposeOptions(\"up\", \"-d\", \"--remove-orphans\"), this.path);\n        if (exitCode !== 0) {\n            throw new Error(\"Failed to start, please check the terminal output for more information.\");\n        }\n        return exitCode;\n    }\n\n    async stop(socket: DockgeSocket) : Promise<number> {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        let exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", this.getComposeOptions(\"stop\"), this.path);\n        if (exitCode !== 0) {\n            throw new Error(\"Failed to stop, please check the terminal output for more information.\");\n        }\n        return exitCode;\n    }\n\n    async restart(socket: DockgeSocket) : Promise<number> {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        let exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", this.getComposeOptions(\"restart\"), this.path);\n        if (exitCode !== 0) {\n            throw new Error(\"Failed to restart, please check the terminal output for more information.\");\n        }\n        return exitCode;\n    }\n\n    async down(socket: DockgeSocket) : Promise<number> {\n        const terminalName = getComposeTerminalName(socket.endpoint, this.name);\n        let exitCode = await Terminal.exec(this.server, socket, terminalName, \"docker\", this.getComposeOptions(\"down\"), this.path);\n        if (exitCode !== 0) {\n            throw new Error(\"Failed to down, please check the terminal output for more information.\");","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/louislam/dockge/blob/f809ae192b571944ad773e9866d3e67064ae8043/backend/stack.ts#L416-L452","documentation":"Stack.stop() runs 'docker compose stop' and throws this Error when it exits non-zero. Cause details are printed to the stack's compose terminal.","triggerScenarios":"compose stop exits non-zero: docker daemon unresponsive, container in a weird state (dead/unresponsive to SIGTERM/SIGKILL within timeout), compose.yaml/project mismatch, low-level runtime (containerd/runc) error.","commonSituations":"Host under heavy load causing stop timeout; container with a broken runtime state after an unclean reboot; daemon restart in progress; user deleted compose.yaml so project lookup fails on some setups.","solutions":["Read the compose terminal output in Dockge for the exact docker error","Check docker daemon health (docker info, systemctl status docker)","Force-remove the stuck container (docker rm -f <container>) then try stop again","If a container ignores SIGTERM, add stop_grace_period in compose.yaml or use docker kill","Restart the Docker daemon if the runtime is wedged"],"exampleFix":"// before\nawait stack.stop(socket);\n// after\ntry {\n    await stack.stop(socket);\n} catch (e) {\n    log.error(\"stop\", `Stop failed for '${stack.name}'; check daemon and consider 'docker rm -f' on stuck containers`);\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"function daemonHealthy(): boolean {\n    try { execSync(\"docker info -f '{{.ServerVersion}}'\"); return true; } catch { return false; }\n}\nif (!daemonHealthy()) {\n    throw new Error(\"Docker daemon not responsive — fix daemon before stopping stacks\");\n}\nawait stack.stop(socket);","typeGuard":"function stoppedCleanly(exitCode: number | undefined): boolean {\n    return exitCode === 0;\n}","tryCatchPattern":"try {\n    await stack.stop(socket);\n} catch (e) {\n    log.error(\"stop\", \"Stop failed — check daemon, force-remove stuck containers (docker rm -f), then retry\");\n    throw e;\n}","preventionTips":["Set stop_grace_period for containers that exit slowly","Avoid stopping stacks during daemon restarts/host reboots","Watch for 'dead' container states and clean them up","Keep host disk and memory from being exhausted"],"tags":["docker","docker-compose","stop","terminal"],"backgroundTag":"docker-compose-stop-failed","analyzedSha":"f809ae192b571944ad773e9866d3e67064ae8043","analyzedAt":"2026-08-31T19:13:50.919Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}