offen/docker-volume-backup

Can't get stop during backup working

pmharris77 opened this issue · 2 comments

What are you trying to do?

My backup of uptimekuma volume is failing due to issues compress a database file:

2024-04-04T00:00:07.493326308Z time=2024-04-04T00:00:07.493Z level=ERROR msg="Unexpected error running schedule @daily: archive/tar: write too long" error="main.runScript.func4: error running script: main.(*script).createArchive: error compressing backup folder: main.createArchive: error creating archive: main.compress: error writing /backup/uptime-kuma-data/kuma.db to archive: main.writeTarball: error copying /backup/uptime-kuma-data/kuma.db to tar writer: archive/tar: write too long"

I think this was because the database was still being written to as the backup was being created. So I added the "stop-during-backup" label to the uptimekuma container to see if it would help, but the uptime of the container shows that it is not being shutdown during backup.

Any ideas?

What is your current configuration?
The following compose project run via Portainer:

services:
  uptime-kuma:
    image: louislam/uptime-kuma:latest
    container_name: uptime-kuma
    labels:
      - docker-volume-backup.stop-during-backup=true
    volumes:
      - data:/app/data
    ports:
      - 3001:3001
    restart: unless-stopped
  backup: # Docker Volume Backup
    image: offen/docker-volume-backup:latest # https://offen.github.io/docker-volume-backup/
    container_name: uptime-kuma-volume-backup
    restart: unless-stopped
    env_file: ./backup.env
    volumes:
      - data:/backup/uptime-kuma-data:ro
volumes:
  data:

Log output

Additional context

m90 commented

You also need to mount the Docker Socket into your backup container as shown in the quickstart example https://offen.github.io/docker-volume-backup/#quickstart

Else, there is no way for your backup container to interact with the host Docker daemon, which is needed to stop containers.

Thanks @m90 I missed this somehow. Will give it a go and see if it works.