louislam/dockge · error · Error

Failed to down, please check the terminal output for more in

Error message

Failed to down, please check the terminal output for more information.

What it means

Stack.down() runs 'docker compose down' (without --remove-orphans) and throws this Error when it exits non-zero; cause is shown in the compose terminal. down stops and removes containers/networks defined by the compose project.

Source

Thrown at backend/stack.ts:452

            throw new Error("Failed to stop, please check the terminal output for more information.");
        }
        return exitCode;
    }

    async restart(socket: DockgeSocket) : Promise<number> {
        const terminalName = getComposeTerminalName(socket.endpoint, this.name);
        let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("restart"), this.path);
        if (exitCode !== 0) {
            throw new Error("Failed to restart, please check the terminal output for more information.");
        }
        return exitCode;
    }

    async down(socket: DockgeSocket) : Promise<number> {
        const terminalName = getComposeTerminalName(socket.endpoint, this.name);
        let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("down"), this.path);
        if (exitCode !== 0) {
            throw new Error("Failed to down, please check the terminal output for more information.");
        }
        return exitCode;
    }

    async update(socket: DockgeSocket) {
        const terminalName = getComposeTerminalName(socket.endpoint, this.name);
        let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("pull"), this.path);
        if (exitCode !== 0) {
            throw new Error("Failed to pull, please check the terminal output for more information.");
        }

        // If the stack is not running, we don't need to restart it
        await this.updateStatus();
        log.debug("update", "Status: " + this.status);
        if (this.status !== RUNNING) {
            return exitCode;
        }

View on GitHub (pinned to f809ae192b)

Solutions

  1. Read the compose terminal output for the exact error
  2. Check docker daemon health (docker info / systemctl status docker)
  3. Detach foreign containers from the project network or remove the network manually (docker network rm)
  4. Force-remove stuck containers (docker rm -f) then retry down
  5. Free disk space if the host is full — teardown writes/removes metadata

Example fix

// before
await stack.down(socket);
// after
try {
    await stack.down(socket);
} catch (e) {
    log.error("down", `Down failed for '${stack.name}'; inspect terminal, then clean up networks/containers manually if needed`);
    throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

function daemonReachable(): boolean {
    try { execSync("docker info"); return true; } catch { return false; }
}
if (!daemonReachable()) {
    throw new Error("Docker daemon unreachable — down will fail");
}
await stack.down(socket);

Type guard

function downOk(exitCode: number | undefined): boolean {
    return exitCode === 0;
}

Try / catch

try {
    await stack.down(socket);
} catch (e) {
    log.error("down", "Down failed — read terminal output; detach foreign network users, rm -f stuck containers, then retry");
    throw e;
}

Prevention

When it happens

Trigger: compose down exits non-zero: daemon unreachable, containers in dead state, network removal failure (network in use by containers outside the project), compose project metadata missing.

Common situations: Host OOM or disk full during teardown; externally-created network attached to project containers; daemon restarting; mixing manual docker commands with Dockge leaving orphaned attachments.

Related errors


AI-assisted analysis of louislam/dockge@f809ae192b (2026-08-31). Data as JSON: /api/errors/aacc7f2ffcd53127. Report an issue: GitHub.