Skip to content

Bug: PostgreSQL restore executes multiple times for large backups #3388

@daimajia

Description

@daimajia

To Reproduce

Description

When restoring a large PostgreSQL backup from S3-compatible storage via the UI, the restore command (pg_restore) is unexpectedly executed multiple times concurrently. Each execution downloads and processes the backup file simultaneously(I see the download activity from network monitor).

Steps to Reproduce

  • Create a PostgreSQL database with a large dataset
  • Configure S3-compatible backup destination
  • Create a backup (resulting in a large .sql.gz file)
  • Attempt to restore the backup via the UI

Current vs. Expected behavior

Expected Behavior

The restore command should execute exactly once and complete successfully.

Actual Behavior

The restore command is executed multiple times. Logs show repeated entries:

Starting restore...
Backup path: :s3:bucket-name/database/2026-01-03T01:00:00.231Z.sql.gz
Executing command: CONTAINER_ID=$(docker ps -q ...) && rclone cat ... | gunzip | docker exec -i $CONTAINER_ID sh -c "pg_restore ..."

Starting restore...
Backup path: :s3:bucket-name/database/2026-01-03T01:00:00.231Z.sql.gz
Executing command: CONTAINER_ID=$(docker ps -q ...) && rclone cat ... | gunzip | docker exec -i $CONTAINER_ID sh -c "pg_restore ..."

(repeats multiple times)

Multiple pg_restore processes run concurrently, each streaming the backup from S3.

Provide environment information

Dokploy version: v0.26.2
Database type: PostgreSQL
Backup destination: S3-compatible storage (Cloudflare R2)
Backup file size: Large (2 GB)

Which area(s) are affected? (Select all that apply)

Databases

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

No response

Will you send a PR to fix it?

Maybe, need help

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions