DockerSelf-Hosting

docker-volume-backup with Docker: Scheduled, Encrypted Volume Backups with a Tested Restore (Linux, Windows, Mac)

Before you start

  • 22 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

docker-volume-backup is a small, free companion container that packs the Docker volumes you choose into a dated archive on a schedule, optionally encrypts it, copies it to a local folder or other storage, and deletes old copies, so a dead disk or a bad update does not take your data with it.

Offen logo, an orange square with a dark circle

Logo: the project has no logo of its own. This is the avatar of its maker offen.software, shown at the top of the project README (press kit, licence CC BY-SA 4.0)

You add one backup service to your Compose file and mount each volume under /backup. Before the archive is made it can stop an app or dump a database, so the copy is consistent. It suits home labs with a handful of Compose stacks.

WhatValue (official sources, read 1 December 2026)
Current versionv2.51.0, released 29 November 2026 (previous: v2.50.2, 23 November)
Image to pinoffen/docker-volume-backup:v2.51.0 (tag checked on Docker Hub; amd64, arm64, arm/v7; also on ghcr.io)
Time neededAbout 40 minutes (our estimate, not measured)
RAMNo official figure (see Performance)
PortsNone. It listens on nothing.
LicenceMPL-2.0 (GitHub shows no paid edition)
Official docsoffen.github.io/docker-volume-backup and the README at v2.51.0

At a glance:

  • What it is: one Go program in a container, under 25 MB, with a built-in cron schedule.
  • Targets: a local folder, S3-compatible storage such as our Garage guide, SSH/SFTP, WebDAV, Azure Blob, Dropbox and Google Drive, in any mix.
  • Safe for data: stop containers during the backup or run a dump first, both set with Docker labels.
  • Not included: no web page, no deduplication (every run is a full archive), no restore command.
  • Restore: you unpack the tar yourself. We walk through it and test it in Step 7.

Which version. We pin v2.51.0. The project releases often: six releases in the six weeks before this guide. Several fixes in v2.49 to v2.51 matter below (SSH host checks, GPG output, S3 part size, vanishing files, a symlink race), so we do not go back. Read the release notes before every upgrade. We found no open report that stops a normal install.

How it fits together#

On each schedule tick the backup container optionally dumps or stops your apps, packs everything under /backup into a tar archive, encrypts it, copies it to every target you set, and then prunes old archives.

Flow: apps with labels and their volumes are read by the docker-volume-backup container, which uses the Docker socket to stop containers and run dumps, makes a tar archive, optionally encrypts it, copies it to a local folder and to S3 storage, and sends a notice on errors

Drawn for this guide from the official README, reference and source at v2.51.0.

Four words: an archive is the tar file (gzip by default). A label is a setting on another container. Retention is how many days old archives are kept. A lifecycle step is one phase of a run: archive, process (encrypt), copy, prune.

The order matters: pre-commands (dump), stop containers, make the archive, start containers again, then encrypt, copy and prune. Apps are down only while the tar is written.

Before you start#

SystemWhat to have
LinuxDocker Engine and the Compose plugin; x86-64, arm64 or ARMv7
WindowsWindows 10 or later, Docker Desktop (Linux containers), PowerShell
MacDocker Desktop, Intel or Apple Silicon
Run in terminalbash
docker --version
docker compose version

Checklist:

  • [ ] Both commands print a version
  • [ ] You know your time zone name, such as Europe/London
  • [ ] You can store a passphrase in a password manager (Step 4)
  • [ ] Docker's disk has room for a second copy of your biggest volume (the archive is built inside the container)
  • [ ] Optional: Garage running for Step 6, and ntfy for the failure notice in Step 5

Tested by DIY Lab Hub: not yet. Linux = not run, Windows = not run, Mac = not run. Every command comes from the official docs and the source at v2.51.0, which we read on 1 December 2026, and we have not run it. Where we adapted a command, we say so.

Tip: We use a demo stack (a file app and a PostgreSQL database) to show both safety methods. When it works, swap in your own services and keep backup.

Docker Desktop on Windows and Mac: paths and volumes#

TopicWhat to know
Named volumesThey live inside Docker Desktop's Linux VM, not in a folder you can open. The backup container reads them as on Linux.
Host foldersOur archive folder is a bind mount under your user folder. That crosses Docker Desktop's file sharing, which is slower. For big archives use a volume or a remote target.
Docker socketDocker's FAQ says Mac and Windows WSL 2 users reach the engine at unix:///var/run/docker.sock. We mount that path into the backup container, as the project does. We have not run it on Docker Desktop.
Docker Desktop on Linux, rootless DockerThe FAQ says Desktop on Linux uses ~/.docker/desktop/docker.sock. Rootless Docker uses its own socket, see the rootless how-to.
Always onThe schedule runs inside the container, so the computer must be awake with Docker running at 03:00. A laptop that sleeps misses it (our reasoning).
Line endingsThe project saw crond: user root: parse error at * for config files with CRLF line endings (issue 349). We write our env files with LF.

Step 1: Create the folders and the secret files#

Everything lives in ~/docker_volumes/volume-backup. Two files hold secrets: .env (read by Compose) and backup.env (read by the backup container). We keep settings in backup.env, as the project's own example does.

Avoid $, #, spaces and quotes in passwords: Compose reads them as syntax.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/volume-backup/{archive,restore}
cd ~/docker_volumes/volume-backup
cat > .env << 'EOF'
DB_PASSWORD=<db-password>
EOF
cat > backup.env << 'EOF'
TZ=<your-timezone>
BACKUP_CRON_EXPRESSION=0 3 * * *
EOF
chmod 600 .env backup.env

Windows (PowerShell)#

Codepowershell
$base = "$HOME\docker_volumes\volume-backup"
New-Item -ItemType Directory -Force "$base\archive","$base\restore" | Out-Null
Set-Location $base
function Add-EnvLine($file, $line) { [IO.File]::AppendAllText((Join-Path $PWD $file), "$line`n") }
Add-EnvLine ".env" "DB_PASSWORD=<db-password>"
Add-EnvLine "backup.env" "TZ=<your-timezone>"
Add-EnvLine "backup.env" "BACKUP_CRON_EXPRESSION=0 3 * * *"

Add-EnvLine writes plain LF lines. Define it again if you open a new window.

Mac (Terminal)#

Same commands as Linux.

Check it worked. ls -la (Windows: Get-ChildItem -Force) shows .env, backup.env, archive and restore.

Tip: The schedule 0 3 * * * means 03:00 every day. The default, @daily, is midnight. The container runs in UTC unless TZ is set, which is why we set it.

Step 2: Write the Compose file#

The file has three services: app (any container with files), db (a database) and backup (the tool). We pin all images.

LineWhy
name: backup-demoFixes the project name, so volumes are called backup-demo_app_data and so on.
docker-volume-backup.stop-during-backup=trueStop this container while the archive is written, then start it again.
docker-volume-backup.archive-pre=...Runs inside db before the archive and writes a dump. /bin/sh -c is needed for the > redirect.
db_dump:/dump and db_dump:/backup/db_dump:roThe same volume is mounted in db (writes the dump) and in backup (reads it, read-only).
/backup/<name>The tool archives only what is under /backup. A volume mounted elsewhere is not backed up.
/var/run/docker.sockNeeded to stop containers and run label commands. It gives root-level control of Docker, see Security.
./archive:/archiveThe local copy. If this folder is not mounted, the local backup is skipped.

We back up the dump, not the raw db_data volume, so no half-written database files end up in the archive.

Linux#

Run in terminalbash
cd ~/docker_volumes/volume-backup
cat > compose.yaml << 'EOF'
name: backup-demo

services:
  app:
    image: alpine:3.24.4
    container_name: demo-app
    init: true
    restart: unless-stopped
    command: ["tail", "-f", "/dev/null"]
    volumes:
      - app_data:/data
    labels:
      - docker-volume-backup.stop-during-backup=true

  db:
    image: postgres:17.12-alpine3.24
    container_name: demo-db
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: appdb
    volumes:
      - db_data:/var/lib/postgresql/data
      - db_dump:/dump
    labels:
      - docker-volume-backup.archive-pre=/bin/sh -c 'pg_dump -U postgres -Fc appdb > /dump/db.dump'

  backup:
    image: offen/docker-volume-backup:v2.51.0
    container_name: volume-backup
    restart: unless-stopped
    env_file: backup.env
    volumes:
      - app_data:/backup/app_data:ro
      - db_dump:/backup/db_dump:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./archive:/archive

volumes:
  app_data:
  db_data:
  db_dump:
EOF

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\volume-backup"
@'
name: backup-demo

services:
  app:
    image: alpine:3.24.4
    container_name: demo-app
    init: true
    restart: unless-stopped
    command: ["tail", "-f", "/dev/null"]
    volumes:
      - app_data:/data
    labels:
      - docker-volume-backup.stop-during-backup=true

  db:
    image: postgres:17.12-alpine3.24
    container_name: demo-db
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: appdb
    volumes:
      - db_data:/var/lib/postgresql/data
      - db_dump:/dump
    labels:
      - docker-volume-backup.archive-pre=/bin/sh -c 'pg_dump -U postgres -Fc appdb > /dump/db.dump'

  backup:
    image: offen/docker-volume-backup:v2.51.0
    container_name: volume-backup
    restart: unless-stopped
    env_file: backup.env
    volumes:
      - app_data:/backup/app_data:ro
      - db_dump:/backup/db_dump:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./archive:/archive

volumes:
  app_data:
  db_data:
  db_dump:
'@ | Set-Content -Encoding ascii compose.yaml

Mac (Terminal)#

Same commands as Linux.

Check it worked. docker compose config --quiet prints nothing when the file is valid.

Tip: The dump command needs no password because the official PostgreSQL image trusts local socket connections. Never put secrets into labels: docker inspect shows them.

Step 3: Start it, add test data and run the first backup#

We put a known file in the app volume and a known row in the database, then run a backup by hand instead of waiting for 03:00.

Linux#

Run in terminalbash
cd ~/docker_volumes/volume-backup
docker compose up -d
docker compose ps
docker compose exec app sh -c "echo precious-data > /data/hello.txt"
docker compose exec db psql -U postgres -d appdb -c "CREATE TABLE notes (id serial PRIMARY KEY, body text); INSERT INTO notes (body) VALUES ('first note');"
docker compose logs --tail=20 backup
docker exec volume-backup backup
ls -l archive
docker run --rm -v "$PWD/archive:/archive:ro" alpine:3.24.4 sh -c 'tar -tzf /archive/backup-*.tar.gz'

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\volume-backup"
docker compose up -d
docker compose ps
docker compose exec app sh -c "echo precious-data > /data/hello.txt"
docker compose exec db psql -U postgres -d appdb -c "CREATE TABLE notes (id serial PRIMARY KEY, body text); INSERT INTO notes (body) VALUES ('first note');"
docker compose logs --tail=20 backup
docker exec volume-backup backup
Get-ChildItem archive
docker run --rm -v "${PWD}\archive:/archive:ro" alpine:3.24.4 sh -c 'tar -tzf /archive/backup-*.tar.gz'

Mac (Terminal)#

Same commands as Linux.

Check it worked. The source at v2.51.0 prints these messages (counts and times will differ):

  • At start: Successfully scheduled backup ... with expression 0 3 * * *
  • In the manual run: Running docker-volume-backup.archive-pre command ... for container demo-db, then Stopping 1 out of ... running container(s), then Created backup of /backup at /tmp/backup-...tar.gz, then Restarted 1 out of 1 stopped container(s), then Stored copy of backup ... in /archive.

The tar -tzf list should show backup/app_data/hello.txt and backup/db_dump/db.dump. Every path starts with backup/ and then the name you gave the mount.

Tip: If archive-pre fails (a wrong database name, for example), the whole run stops with running command exited 1 and no archive is made. That is on purpose: you never get a silent backup without the dump.

Step 4: Encrypt the archives#

The tool can encrypt with GPG or age. We use a GPG passphrase, the simplest; set only one method. Without it, anyone who reaches your archive folder or bucket can read your data.

Do this first: generate a long passphrase and save it in your password manager. If you lose it, the archives cannot be opened and nobody can reset it. Keep a copy off this machine: a dead machine takes backup.env with it.

Linux#

Run in terminalbash
cd ~/docker_volumes/volume-backup
openssl rand -base64 24
echo "GPG_PASSPHRASE=<paste-the-passphrase>" >> backup.env
docker compose up -d
rm archive/backup-*.tar.gz
docker exec volume-backup backup
ls -l archive

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\volume-backup"
# Create 24+ letters and digits in your password manager, save them there, then:
Add-EnvLine "backup.env" "GPG_PASSPHRASE=<paste-the-passphrase>"
docker compose up -d
Remove-Item archive\backup-*.tar.gz
docker exec volume-backup backup
Get-ChildItem archive

Mac (Terminal)#

Same commands as Linux.

Check it worked. The new file ends in .tar.gz.gpg. We deleted the first, unencrypted archive because it holds the same data without protection.

Tip: Compose copies backup.env into the container when it is created. After any edit run docker compose up -d again. Any setting also accepts a _FILE suffix (GPG_PASSPHRASE_FILE) for Docker secrets. v2.50.0 made GPG output binary; for base64 text set GPG_OUTPUT=armored.

Step 5: Retention, schedule and a failure notice#

Add three lines: keep 14 days, prune only files that start with backup-, and send errors to ntfy.

Linux#

Run in terminalbash
cd ~/docker_volumes/volume-backup
cat >> backup.env << 'EOF'
BACKUP_RETENTION_DAYS=14
BACKUP_PRUNING_PREFIX=backup-
NOTIFICATION_URLS=ntfy://<user>:<password>@<ntfy-host>:<port>/<topic>?disabletls=yes
NOTIFICATION_LEVEL=info
EOF
docker compose up -d
docker exec volume-backup backup

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\volume-backup"
Add-EnvLine "backup.env" "BACKUP_RETENTION_DAYS=14"
Add-EnvLine "backup.env" "BACKUP_PRUNING_PREFIX=backup-"
Add-EnvLine "backup.env" "NOTIFICATION_URLS=ntfy://<user>:<password>@<ntfy-host>:<port>/<topic>?disabletls=yes"
Add-EnvLine "backup.env" "NOTIFICATION_LEVEL=info"
docker compose up -d
docker exec volume-backup backup

Mac (Terminal)#

Same commands as Linux.

Check it worked. The log says None of 1 existing backups were pruned. and your phone gets a message. The notification library is shoutrrr. Its ntfy page lists disabletls for plain HTTP at home. With HTTPS, drop that parameter. Now remove NOTIFICATION_LEVEL=info from the file and run docker compose up -d. The default, error, sends a message only when a run fails.

Tip: A failure notice cannot tell you that backups never ran, for example because the container is stopped. The official notifications page shows a heartbeat monitor for that. Until you add one, check docker compose ps weekly.

Pruning looks at every file in the target folder or bucket, which is why we set a prefix. If a setting would delete all backups, the tool refuses and logs Refusing to do so, please check your configuration.

Step 6: Copy the archives to Garage (S3)#

A copy on the same machine does not survive that machine. Our Garage guide gives you S3 storage at home. The settings are named AWS_... but work with any S3 server.

We create a separate bucket and key, so pruning never touches other data. Run these in the Garage folder:

Run in terminalbash
cd ~/docker_volumes/garage
docker compose exec garage /garage bucket create volume-backups
docker compose exec garage /garage key create volume-backup-key
docker compose exec garage /garage bucket allow --read --write volume-backups --key volume-backup-key

On Windows run the same three commands in $HOME\docker_volumes\garage. key create prints a Key ID and a secret. Save both in your password manager.

The backup container must reach Garage by name. Garage's Compose file calls its network garage-net. A file named compose.override.yaml is merged by Compose automatically.

Linux#

Run in terminalbash
cd ~/docker_volumes/volume-backup
cat > compose.override.yaml << 'EOF'
services:
  backup:
    networks:
      - default
      - garage-net

networks:
  garage-net:
    external: true
EOF
cat >> backup.env << 'EOF'
AWS_ENDPOINT=garage:3900
AWS_ENDPOINT_PROTO=http
AWS_S3_BUCKET_NAME=volume-backups
AWS_S3_PATH=demo
AWS_ACCESS_KEY_ID=<KEY_ID>
AWS_SECRET_ACCESS_KEY=<SECRET_KEY>
EOF
docker compose up -d
docker exec volume-backup backup
cd ~/docker_volumes/garage && docker compose exec garage /garage bucket info volume-backups

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\volume-backup"
@'
services:
  backup:
    networks:
      - default
      - garage-net

networks:
  garage-net:
    external: true
'@ | Set-Content -Encoding ascii compose.override.yaml
Add-EnvLine "backup.env" "AWS_ENDPOINT=garage:3900"
Add-EnvLine "backup.env" "AWS_ENDPOINT_PROTO=http"
Add-EnvLine "backup.env" "AWS_S3_BUCKET_NAME=volume-backups"
Add-EnvLine "backup.env" "AWS_S3_PATH=demo"
Add-EnvLine "backup.env" "AWS_ACCESS_KEY_ID=<KEY_ID>"
Add-EnvLine "backup.env" "AWS_SECRET_ACCESS_KEY=<SECRET_KEY>"
docker compose up -d
docker exec volume-backup backup
Set-Location "$HOME\docker_volumes\garage"
docker compose exec garage /garage bucket info volume-backups

Mac (Terminal)#

Same commands as Linux.

Check it worked. The log shows a Uploaded a copy of backup line for the S3 storage, and bucket info lists one object. AWS_S3_PATH is a folder name inside the bucket, with no leading slash.

The tool has no region setting, so we could not check how it behaves with Garage's region name garage. The issue tracker shows a user running it daily against Garage (see Known bugs).

Tip: Do not set AWS_PART_SIZE unless you back up very large archives. The reference says it defaults to 16 MB, but setting it made small backups fail until v2.51.0 (issue 910).

Step 7: Test the restore#

A backup you have never restored is only a hope. The tool has no restore command (issue 146 is open since 2022). You decrypt, unpack, look at the files and load the dump. We do it into a scratch folder first, so nothing live is touched. Our docker run commands below adapt the official how-to; we have not run them.

The first command decrypts the newest local archive with the same passphrase from backup.env and unpacks it into restore/. It runs gpg in a throwaway Alpine container, so you need no GPG on the host. Without encryption, use tar -xzf /archive/$F -C /restore instead.

Linux#

Run in terminalbash
cd ~/docker_volumes/volume-backup
f=$(ls -1t archive | head -n 1)
docker run --rm --env-file backup.env -e F=$f \
  -v "$PWD/archive:/archive:ro" -v "$PWD/restore:/restore" \
  alpine:3.24.4 sh -c 'apk add --no-cache gnupg >/dev/null && gpg --batch --pinentry-mode loopback --passphrase $GPG_PASSPHRASE -d /archive/$F | tar -xz -C /restore'
find restore -type f
cat restore/backup/app_data/hello.txt

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\volume-backup"
$f = (Get-ChildItem archive | Sort-Object LastWriteTime -Descending | Select-Object -First 1).Name
docker run --rm --env-file backup.env -e "F=$f" -v "${PWD}\archive:/archive:ro" -v "${PWD}\restore:/restore" alpine:3.24.4 sh -c 'apk add --no-cache gnupg >/dev/null && gpg --batch --pinentry-mode loopback --passphrase $GPG_PASSPHRASE -d /archive/$F | tar -xz -C /restore'
Get-ChildItem -Recurse -File restore | Select-Object FullName
Get-Content restore\backup\app_data\hello.txt

Mac (Terminal)#

Same commands as Linux.

Check it worked. You see precious-data. find lists backup/app_data/hello.txt and backup/db_dump/db.dump. If tar complains, the passphrase or file name was wrong. Restored files belong to root, which is normal.

Now prove the database dump loads. We restore it into a new database next to the real one:

Run in terminalbash
docker compose cp restore/backup/db_dump/db.dump db:/tmp/db.dump
docker compose exec db createdb -U postgres notes_check
docker compose exec db pg_restore -U postgres -d notes_check /tmp/db.dump
docker compose exec db psql -U postgres -d notes_check -c "SELECT * FROM notes;"
docker compose exec db dropdb -U postgres notes_check

On Windows write the first path as restore\backup\db_dump\db.dump; the rest is identical. The query must print first note. When it does, your dump, your passphrase and your steps all work.

Putting files back for real. Stop the app, copy the restored files into its volume, start it:

Run in terminalbash
docker compose stop app
docker run --rm -v backup-demo_app_data:/data -v "$PWD/restore/backup/app_data:/from:ro" alpine:3.24.4 cp -a /from/. /data/
docker compose start app

On Windows, write the -v path as "${PWD}\restore\backup\app_data:/from:ro". Copying over keeps files that were added after the backup. To roll a volume back exactly, follow the official restore how-to: remove the volume and unpack into a new one. For a database, drop the database, create it empty, and pg_restore the dump. Do not copy files into a running database's data folder.

Finally clean the scratch folder, which holds your decrypted data:

Run in terminalbash
docker run --rm -v "$PWD/restore:/restore" alpine:3.24.4 sh -c 'rm -rf /restore/*'

Tip: Repeat this test after every change of storage, passphrase or tool version. Once a year restore from the remote copy too.

Put it behind HTTPS with Traefik? You do not need to#

This tool serves no web page and opens no port. It only reaches out: to the Docker socket, your storage and your notification service. There is nothing to put behind Traefik or Caddy, at home or on a server.

With Traefik#

No labels or routes are needed.

Without Traefik: Caddy#

No reverse_proxy line is needed for the same reason. For a browser interface for Docker, see our Dockge guide.

Security and testing#

ControlHow
Docker socketAccess to it equals root on the host. Mounting it :ro does not make the Docker API read-only. If you use neither stop labels nor dumps, drop the line. The docs also describe DOCKER_HOST with a socket proxy that allows only the calls it needs.
Secrets.env and backup.env are chmod 600. The passphrase and S3 key are also in your password manager. Never put secrets in labels.
print-configdocker exec volume-backup backup print-config shows the loaded settings, including secrets. Do not paste its output.
Mount read-onlyEvery volume as :ro. A symlink race that could read files outside a volume was fixed in v2.51.0. It needed another container writing to the volume during the run.
S3 keyOne bucket, one key. Do not reuse your admin key.
SSH targetsSince v2.49.2 you must give the host's public key or a known_hosts file. A security fix (advisory).

Status and functionality tests: docker compose ps shows all three services running. docker compose logs --tail=50 backup shows the last run. docker exec volume-backup backup runs one now.

Common mistakes#

MistakeWhy it happensDo this instead
Setting AWS_PART_SIZE=16The reference calls 16 the default. Backups under 16 MB then failed with Your proposed upload size '16777216' exceeds the maximum allowed object size '1002496' for single PUT operation (issue 910, fixed in v2.51.0)Leave it unset, or use v2.51.0 or later
Backing up a live appA file vanished during archiving, and the run aborted with lstat <path>: no such file or directory (issue 908)Stop the app with the label. v2.51.0 adds an opt-in BACKUP_FAIL_ON_VOLATILE_FILESYSTEM=false, but the docs say it is no snapshot and not safe for databases
Using the latest tagA renamed setting became an error: both BACKUP_STOP_DURING_BACKUP_LABEL and BACKUP_STOP_CONTAINER_LABEL have been set, cannot continue. The user's backups stopped for months (issue 882)Pin the tag, rename the old setting, add a failure notice
SSH target fails after an upgradeFrom v2.49.2 the host is checked: SSH hostname given without a public key or known_hosts, refer to the documentation for guidanceSet SSH_HOST_PUBLIC_KEY or SSH_KNOWN_HOSTS_FILE
Copying a database's raw data filesThe files change while they are read, so the archive may not restoreDump with archive-pre, or stop the database during the backup
A dump written outside a mounted volumeThe official MariaDB example mounts the volume at /tmp/backups but writes /backups/dump.sqlWrite into a volume that is mounted at /backup/<name> in the backup container
Setting user: on the backup containerpermission denied. The maintainer says a user is "not really supported" (issue 307, 270)Leave user: out
Retention deletes other filesPruning looks at all files in the targetUse BACKUP_PRUNING_PREFIX and a folder only for backups
AI assistants: docker run offen/docker-volume-backup restore, latest, BACKUP_STOP_CONTAINER_LABEL, BACKUP_FROM_SNAPSHOT, exec-pre labels, EMAIL_* settingsOld tutorials. The restore command does not exist, and the others are deprecatedUnpack the tar (Step 7); use stop-during-backup, archive-pre, NOTIFICATION_URLS, v2.51.0
AI assistants: a volume mounted at /data, or SSH_IGNORE_HOST_KEY, or BACKUP_STOP_DURING_BACKUP__NO_RESTART_LABELOnly /backup is archived. The reference lists the first SSH name and the how-to the double underscore, but the source reads SSH_INSECURE_IGNORE_HOST_KEY and BACKUP_STOP_DURING_BACKUP_NO_RESTART_LABELMount as <volume>:/backup/<name>:ro; check names with backup print-config

Tip: Run docker exec volume-backup backup once by hand and read the log before you trust the schedule.

Tip: Read the release notes before upgrading. v2.49.2 changed SSH, v2.50.0 changed GPG output, and v2.51.0 changed S3 uploads.

Troubleshooting#

ProblemSolution
No archive in ./archiveThe folder is not mounted into /archive. The tool skips the local copy silently.
AWS_S3_BUCKET_NAME is defined, but no credentials were providedSet AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
Apps stay downCheck the log for Restarted ... stopped container(s); start them with docker compose start app
Cannot decryptWrong passphrase, or the archive was made before you changed it. Try the older passphrase.

Exact error texts#

  • running command exited 1 after archive-pre: your dump command failed. Run it by hand with docker compose exec db ....
  • Refusing to do so, please check your configuration.: retention would delete every backup. The tool did nothing. Check BACKUP_RETENTION_DAYS and your prefix.
  • [Code]: NoSuchUpload, [StatusCode]: 404 on S3 after a very large upload: see below.

Known bugs and traps (open or recent, December 2026)#

  • Garage and a 62 GiB archive. Issue 884: the upload failed with NoSuchUpload although the object in Garage was byte-identical. The maintainer called it likely a Garage and S3-client mismatch and closed it as not actionable. Small archives were not reported.
  • Several jobs restart an app several times. Issue 749 is open: each schedule stops and starts the app again.
  • Always uploads, even if nothing changed. Issue 687 is an open request. Use retention to limit growth.
  • Google Drive with a service account. Issue 796: uploads to a personal Drive gave no error. The reporter found service accounts cannot write there.

Diagnose with docker compose ps, docker compose logs --tail=100 backup and docker inspect volume-backup.

Updates and backups#

Update. Read the release notes, change the tag in compose.yaml, then:

Run in terminalbash
cd ~/docker_volumes/volume-backup
docker compose pull
docker compose up -d
docker compose logs --tail=20 backup

Never use latest as an update plan. After the update run one manual backup and the restore test.

What to save besides the archives. The archives are the backup. To get running again on a new machine you also need compose.yaml, backup.env, .env and above all the passphrase. The script below tars those three files with the date. They hold secrets, so keep the result private, and do not store it next to the encrypted archives only.

Linux and Mac#

Save as ~/docker_volumes/volume-backup/save-config.sh:

File contentbash
#!/usr/bin/env bash
set -euo pipefail
base="$HOME/docker_volumes/volume-backup"
mkdir -p "$base/config-copies"
out="$base/config-copies/config-$(date +%F).tar.gz"
tar -czf "$out" -C "$base" compose.yaml .env backup.env
chmod 600 "$out"

Run chmod 700 on it and add 0 4 * * 1 /home/<your-user>/docker_volumes/volume-backup/save-config.sh with crontab -e (weekly, 04:00; on a Mac write /Users/<your-user>/...).

Windows (PowerShell)#

Save as $HOME\docker_volumes\volume-backup\save-config.ps1:

Codepowershell
$base = "$HOME\docker_volumes\volume-backup"
New-Item -ItemType Directory -Force "$base\config-copies" | Out-Null
tar.exe -czf "$base\config-copies\config-$(Get-Date -Format yyyy-MM-dd).tar.gz" -C $base compose.yaml .env backup.env

In Task Scheduler run powershell.exe -NoProfile -File <full-path-to-the-script> weekly at 04:00.

Performance and resources#

The project gives no minimum RAM or CPU, and we measured none. Run docker stats volume-backup to see your own numbers.

The archive is written to /tmp inside the backup container first, which uses Docker's disk, not /archive. Docker's disk needs space for about one compressed archive plus the encrypted copy. An old bug (issue 862, fixed in v2.50.2) left deleted archive files open after failed runs and filled disks.

Compression defaults to gz (GZIP_PARALLELISM defaults to 1; 0 uses all threads). zst or none are set with BACKUP_COMPRESSION. Every run is a full archive, so storage grows with size times kept backups, and BACKUP_RETENTION_DAYS limits that. Before v2.51.0 big S3 uploads sent one part at a time (issue 914); v2.51.0 uploads parts in parallel.

A big volume means a longer stop of your app, which is another reason to dump databases instead.

FAQ#

Is it free? Yes, under MPL-2.0. We saw no paid edition. You pay only for storage.

Does it restore for me? No. There is no restore command (issue 146). You unpack the tar yourself, as in Step 7.

Should I use it, restic or Kopia? This tool makes simple full tar archives of volumes, steered by labels, and has no web page. restic and Kopia make deduplicated, encrypted snapshots and suit big data that changes little. Use this one for small to medium Compose stacks.

Why does it need the Docker socket, and is that safe? Only to stop containers and run label commands. Access to the socket equals root on the host, and :ro does not limit the Docker API. Leave it out if you use neither feature, or put a socket proxy in front.

Sources#

Checked against the official docs on 2026-12-01.