Dokploy/dokploy · critical · Error

Dokploy Postgres container not found

Error message

Dokploy Postgres container not found

What it means

The web-server restore needs the running Dokploy Postgres container to import database.sql into. It runs docker ps filtered by name=dokploy-postgres and status=running, and throws when no container matches.

Source

Thrown at packages/server/src/utils/restore/web-server.ts:94

			if (hasGzFile.includes("database.sql.gz")) {
				emit("Found compressed database file, decompressing...");
				await execAsync(`cd ${tempDir} && gunzip database.sql.gz`);
			}

			// Verify database file exists
			const { stdout: hasSqlFile } = await execAsync(
				`ls ${tempDir}/database.sql || true`,
			);
			if (!hasSqlFile.includes("database.sql")) {
				throw new Error("Database file not found after extraction");
			}

			const { stdout: postgresContainer } = await execAsync(
				`docker ps --filter "name=dokploy-postgres" --filter "status=running" -q | head -n 1`,
			);

			if (!postgresContainer) {
				throw new Error("Dokploy Postgres container not found");
			}

			const postgresContainerId = postgresContainer.trim();

			// Drop and recreate database
			emit("Disconnecting all users from database...");
			await execAsync(
				`docker exec ${postgresContainerId} psql -U dokploy postgres -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'dokploy' AND pid <> pg_backend_pid();"`,
			);

			emit("Dropping existing database...");
			await execAsync(
				`docker exec ${postgresContainerId} psql -U dokploy postgres -c "DROP DATABASE IF EXISTS dokploy;"`,
			);

			emit("Creating fresh database...");
			await execAsync(
				`docker exec ${postgresContainerId} psql -U dokploy postgres -c "CREATE DATABASE dokploy;"`,

View on GitHub (pinned to 546686ea35)

Solutions

  1. Start the container: docker start dokploy-postgres (or docker compose up -d in the dokploy directory)
  2. Confirm the exact name: docker ps -a | grep postgres
  3. Verify the Docker daemon is reachable from the server process
  4. If the container name differs, align it or update the filter/restore logic
Defensive patterns

Strategy: validation

Validate before calling

const running = execSync('docker ps --filter name=dokploy-postgres --filter status=running -q').toString().trim();
if (!running) throw new Error('Start dokploy-postgres before restoring');

Prevention

When it happens

Trigger: Postgres container stopped or restarting, container renamed, Docker not running on the host, or filter mismatch because the container runs under a different name/compose project.

Common situations: Host rebooted and the stack didn't come up; user renamed the container; running restore on a remote/standalone server where the local dokploy-postgres doesn't exist.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/7439a4596f373a99. Report an issue: GitHub.