Dokploy / Dokploy/dokploy

Database backup fail when database is in worker node

Open
#3,516 5 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
TypeScript
Stars
37.4k
Forks
3k
Avg merge
1d 3h
Merged PRs (30d)
73

Description

To Reproduce
  1. Setup a worker in your swarm
  2. Add a label to the worker (eg. docker node update --label-add type=database <node-name>)
  3. Setup a postgres database application to the worker (don't deploy yet)
  4. Add a constraint to the postgres database application
{
  "Constraints": [
    "node.labels.type == database", // or whatever you label the worker
    "node.role == worker"
  ]
}
  1. Deploy the database application
  2. Setup database backup
  3. Manually trigger the backup
Current vs. Expected behavior

Currently
It throws an error

Initializing backup
[Sat Jan 24 04:02:23 UTC 2026] Starting backup process...
[Sat Jan 24 04:02:23 UTC 2026] Executing backup command...
[Sat Jan 24 04:02:23 UTC 2026] ❌ Error: Container not found

Expected
Database backup created successfully.

Provide environment information
Operating System: Ubuntu 24.04.3 LTS (manager and worker vps)
Dokploy Version: v0.26.5
VPS Provider: Hetzner
What applications/services are you trying to deploy: Database
Which area(s) are affected? (Select all that apply)

Databases

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

Remote server

Additional context

I have done some digging and the reason this happened is because the backup command code on packages/server/src/utils/backups/postgres.ts

await execAsync(backupCommand, {
	shell: "/bin/bash",
});

is ran on the manager vps. But since the database is in a worker (different vps), it couldn't find the container, hence the error.

Will you send a PR to fix it?

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/server/src/utils/backups/postgres.ts, especially the execAsync call used during the backup process. Reproduce the failure with a PostgreSQL database constrained to a worker node, then trace how the backup command is executed. Done means a manually triggered backup creates the database backup successfully on the remote worker.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, postgresql, typescript
Domain
backend, databases, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.