docker-volume-backup: Robust Docker Volume Backups to Multiple Storages

docker-volume-backup: Robust Docker Volume Backups to Multiple Storages

Summary

docker-volume-backup is a lightweight companion container designed for robust Docker volume backups. It handles recurring or one-off backups to various destinations like S3, WebDAV, Azure Blob Storage, Dropbox, Google Drive, or SSH, and includes features like encryption and old backup rotation. This tool ensures your Docker data is safely stored and easily recoverable.

Repository Info

Updated on April 23, 2026
View on GitHub

Tags

Click on any tag to explore related repositories

Introduction

docker-volume-backup is an essential tool for anyone managing Docker environments. It provides a flexible and lightweight solution, packaged as a Docker image (below 25MB), for backing up Docker volumes. Whether you need to store backups locally or leverage cloud storage providers, this tool offers comprehensive support for S3, WebDAV, Azure Blob Storage, Dropbox, Google Drive, and SSH compatible storage.

Key features include recurring or one-off backup capabilities, rotation of old backups, GPG encryption for enhanced security, and notifications for backup run statuses.

Installation

To integrate docker-volume-backup into your Docker setup, the simplest way is to use its official Docker image. It can be added as a companion container to your existing Docker Compose setup or run as a standalone command for one-off backups.

For production environments, it is recommended to pin your image tag to a specific release version instead of latest to ensure stability.

Examples

Recurring backups in a Compose setup

Add a backup service to your docker-compose.yml and mount the volumes you wish to back up. This example also demonstrates how to stop a container during backup for data integrity and how to store local copies.

services:
  volume-consumer:
    build:
      context: ./my-app
    volumes:
      - data:/var/my-app
    labels:
      # This means the container will be stopped during backup to ensure
      # backup integrity. You can omit this label if stopping during backup
      # not required.
      - docker-volume-backup.stop-during-backup=true

  backup:
    # In production, it is advised to lock your image tag to a proper
    # release version instead of using `latest`.
    # Check https://github.com/offen/docker-volume-backup/releases
    # for a list of available releases.
    image: offen/docker-volume-backup:latest
    restart: always
    env_file: ./backup.env # see below for configuration reference
    volumes:
      - data:/backup/my-app-backup:ro
      # Mounting the Docker socket allows the script to stop and restart
      # the container during backup. You can omit this if you don't want
      # to stop the container. In case you need to proxy the socket, you can
      # also provide a location by setting `DOCKER_HOST` in the container
      - /var/run/docker.sock:/var/run/docker.sock:ro
      # If you mount a local directory or volume to `/archive` a local
      # copy of the backup will be stored there. You can override the
      # location inside of the container by setting `BACKUP_ARCHIVE`.
      # You can omit this if you do not want to keep local backups.
      - /path/to/local_backups:/archive
volumes:
  data:

One-off backups using Docker CLI

For a single backup operation, you can use the Docker CLI. Mount the target volume and provide the necessary environment variables for your chosen storage backend.

docker run --rm \
  -v data:/backup/data \
  --env AWS_ACCESS_KEY_ID="<xxx>" \
  --env AWS_SECRET_ACCESS_KEY="<xxx>" \
  --env AWS_S3_BUCKET_NAME="<xxx>" \
  --entrypoint backup \
  offen/docker-volume-backup:v2

Alternatively, you can pass an --env-file with your full configuration.

Why Use It?

docker-volume-backup stands out due to its versatility and robust feature set:

  • Multi-Storage Support: Backup to local directories, S3, WebDAV, Azure Blob Storage, Dropbox, Google Drive, or SSH, offering unparalleled flexibility.
  • Lightweight: The Docker image is small, ensuring minimal overhead in your environment.
  • Data Integrity: Option to stop containers during backup to guarantee consistent data snapshots.
  • Security: Supports GPG encryption for your backups, protecting sensitive data.
  • Automation: Easily configure recurring backups and automatic rotation of old backups.
  • Notifications: Stay informed with notifications for successful or failed backup runs.

Links