Volume backup silently uploads an empty tar when the volume does not exist on the host (stack prefix missing / service on swarm worker)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- docker, typescript
Research direction
Start in packages/server/src/utils/volume-backups/backup.ts, where the docker run --rm -v ${volumeName}:/volume_data ... command is assembled and its output streamed into the backup log. Add a docker volume inspect "$VOLUME" (or --mount type=volume,src=...,volume-nocopy) check before the run and route the failure into the same error path the existing failure branches use, so the run is marked failed instead of logging Volume backup done ✅. Done means a nonexistent volume name produces a clear error and no uploaded tar, while a valid volume still backs up; the sibling database-backup code is a useful reference for how errors are surfaced.
Written by the indexing model from the issue text.
Description
To Reproduce
- Create a Docker Compose service of type Stack (swarm) with a named volume, e.g.
pgdata. Docker creates it as<appName>_pgdata. - Add a volume backup with volume name
pgdata, i.e. without the stack prefix. The UI accepts any string. - Alternative way to trigger it: use the correct full name, but pin the service to a worker node. The backup command always runs on the Dokploy/manager server, so the volume does not exist there.
- Run the volume backup, manually or on its schedule.
Current vs. Expected behavior
Current: The backup runs docker run --rm -v ${volumeName}:/volume_data ... ubuntu tar cvf ... (packages/server/src/utils/volume-backups/backup.ts). If no volume with that name exists on the host, docker run silently creates a new empty volume, and an empty tar of 10240 bytes is uploaded. The log ends with Volume backup done ✅ / Upload to S3 done ✅, so nothing tells you the backup is useless.
We only found out when we needed a restore. A Postgres volume had been "backed up" every night for two months, and all 60 retained files were empty tars. Seven of our 17 volume backups were affected:
- some because the stack prefix was missing from the configured name,
- some because the service runs on a swarm worker.
Each run also leaves an empty stray volume with the configured name on the manager.
Expected:
- The backup fails with a clear error if the volume does not exist on the host where the command runs. For example, check
docker volume inspect "$VOLUME"before thedocker run, or use--mount type=volume,src=...,volume-nocopy. Plain-vauto-creates the volume, so it does not help here. - Optionally, the UI validates or suggests the real volume name (including the
<appName>_prefix for stacks). - Optionally, a warning when the backed-up volume is empty.
The swarm worker case is the broader limitation tracked in #2692, and #3516 covers it for database backups. Database backups at least fail with Container not found there. Volume backups report success instead, which is the dangerous part.
Provide environment information
Dokploy version: v0.31.1 (code checked against v0.31.2, same behavior)
OS: Debian 13
Setup: 2-node Docker Swarm (Dokploy on the manager, services on manager and worker), Compose type "Stack"
Destination: S3-compatible
Which area(s) are affected? (Select all that apply)
Docker Compose, Docker
Are you deploying the applications where Dokploy is installed or on a remote server?
Both
Additional context
Minimal demonstration of the root cause:
docker volume ls -q | grep -x does-not-exist # nothing
docker run --rm -v does-not-exist:/volume_data ubuntu bash -c 'cd /volume_data && tar cf - . | wc -c'
# 10240 -> empty tar, exit code 0
docker volume ls -q | grep -x does-not-exist # now exists (created by the run)
Will you send a PR to fix it?
No
- Dominant language
- TypeScript
- Stars
- 38.8k
- Forks
- 3.2k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 117
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Dokploy/dokploy
-
Docker > Volumes: sorting by Size does nothing, and text columns sort inconsistentlyPossibly taken @BitPluto claimed this today. Openneeds-triage🔍
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Dokploy/dokploy#6203 · 1 comment ·
Maintainers usually reply within 1 day
-
needs-triage🔍
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Dokploy/dokploy#6197 · 1 comment ·
Maintainers usually reply within 1 day
-
Healthy Swarm task shows an empty `(Error:)` suffix on the last row of the Containers tabPossibly taken @AyhamJo7 claimed this 7 days ago. Openneeds-triage🔍
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Dokploy/dokploy#6115 · 1 comment ·
Maintainers usually reply within 1 day
-
MongoDB with Replica Sets enabled: container exits with code 0 and restarts in a loop (generated startup script never waits on mongod)Possibly taken @ghazy2001 claimed this 13 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Dokploy/dokploy#6051 · 2 comments ·
Maintainers usually reply within 1 day
-
Dokploy monitoring API returns partial container metrics with HTTP 200 when a row read failsPossibly taken @PAtreju claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Dokploy/dokploy#6029 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
🔨 tool 🧰 library
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Orange-OpenSource/Orange-Boosted-Bootstrap#4035 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
DISIC/teleservice-conformite#230 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
rothgar/rabble.radio#410 ·
Maintainers usually reply within 1 day
-
area/webapp comp/desktop P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#163341 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
smart-village-solutions/smart-speech-flow#765 ·
Maintainers usually reply within 1 day