Backup docker volumes #3660
-
Is it possible to backup docker volumes to the s3 bucket? I don't see where that option is. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@dgloukhman I'm not aware of an option in Coolify to do that. My solution for that is
volumes:
- '/var/lib/docker/volumes:/source:ro'
|
Beta Was this translation helpful? Give feedback.
-
@Procuria
did the trick |
Beta Was this translation helpful? Give feedback.
-
I tried duplicati but really struggled to get it to stop containers before backups. docker-volume-backup seems like a good option. Here's an example backup up umami's postgresql volume. The compose is from the default recipe, with one service added, and a label added to postgresql to indicate that it should be stopped. services:
umami:
image: 'ghcr.io/umami-software/umami:postgresql-latest'
environment:
- SERVICE_FQDN_UMAMI
- 'DATABASE_URL=postgres://$SERVICE_USER_POSTGRES:$SERVICE_PASSWORD_POSTGRES@postgresql:5432/$POSTGRES_DB'
- DATABASE_TYPE=postgres
- APP_SECRET=$SERVICE_PASSWORD_64_UMAMI
depends_on:
postgresql:
condition: service_healthy
postgresql:
image: 'postgres:15-alpine'
volumes:
- 'postgresql-data:/var/lib/postgresql/data'
environment:
- POSTGRES_USER=$SERVICE_USER_POSTGRES
- POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES
- 'POSTGRES_DB=${POSTGRES_DB:-umami}'
healthcheck:
test:
- CMD-SHELL
- 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'
interval: 5s
timeout: 5s
retries: 10
labels:
- docker-volume-backup.stop-during-backup=true
postgresql-backup:
image: offen/docker-volume-backup:latest
restart: always
environment:
- AWS_S3_PATH=$BACKUP_AWS_S3_PATH
- AWS_S3_BUCKET_NAME=$BACKUP_AWS_S3_BUCKET_NAME
- AWS_ENDPOINT=$BACKUP_AWS_ENDPOINT
- AWS_ACCESS_KEY_ID=$BACKUP_AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY=$BACKUP_AWS_SECRET_ACCESS_KEY
volumes:
- postgresql-data:/backup/postgresql-data:ro
- /var/run/docker.sock:/var/run/docker.sock:ro |
Beta Was this translation helpful? Give feedback.
@dgloukhman I'm not aware of an option in Coolify to do that.
My solution for that is
/var/lib/docker/volumes
(or whereve you have your docker_root directory ) into the Duplicati container