Skip to main content

Backup & Restore

For the backup we can use the vaultwarden_backup image.

docker-compose.yml
services:
  vaultwarden_backup:
    image: jmqm/vaultwarden_backup:latest
    container_name: vaultwarden_backup
    network_mode: none
    # command: manual
    volumes:
      - ./data/:/data:ro # Read-only
      - ./backup:/backups
      - /etc/localtime:/etc/localtime:ro # Container uses date from host.
    environment:
      - DELETE_AFTER=30
      - CRON_TIME=* */24 * * * # Runs at 12:00 AM.
      - UID=${PUID}
      - GID=${PGID}

Backing up

Simply set the CRON_TIME to the desired backup frequency. If you want to force a backup, uncomment command: manual and restart the container.

Restore

Create a new folder (e.g. mkdir ~/vaultwarden_restore). Unzip the desired tarball with tar xvf <backup>.tar.xz -C ~/vaultwarden_restore. Then, simply move over all extracted files and folders to the data folder of a new install.

Things to remember

  • Make sure that permission are set correctly and check backups periodically

See also