Docker image to backup files with remote nextcloud.
256
Docker image to backup files with remote nextcloud.
/backup/This container synchronizes files in a directory named /backup/ with a remote nextcloud.
Mount the host directory containing the files to be backed up to /backup/ of this container.
/backup.shThis container can execute a complex process to prepare the files to be backed up.
If you want to execute the complex process, create a script that places the files to be backed up to /backup/ and mount the script as backup.sh to /.
If backup.sh is not mounted, the following script is generated by default.
#!/bin/bash
| environment | default | required | description |
|---|---|---|---|
| CRON_EXP | 0 * * * * | no | cron expression |
| CRON_USER | root | no | user who execute cron command |
| NC_URL | yes | URL of Nextcloud's folder | |
| NC_USER | yes | user of Nextcloud | |
| NC_PASSWORD | yes | password for the user of nextcloud |
From the following environments:
environment:
- "CRON_EXP=0 * * * *"
- "CRON_USER=root"
- "NC_URL=http://nextcloud/remote.php/webdav/"
- "NC_USER=nc_user"
- "NC_PASSWORD=nc_password"
the following /etc/crontab is generated.
0 * * * * root /backup.sh && nextcloudcmd --user nc_user --password nc_password /backup/ http://nextcloud/remote.php/webdav/
Execute docker-compose up -d with the following docker-compose.yml.
version: '3'
services:
backup:
image: 'jumpaku/backup-with-nextcloud'
environment:
- 'NC_URL=http://nextcloud.example.com/remote.php/webdav/'
- 'NC_USER=nc_user'
- 'NC_PASSWORD=nc_password'
volumes:
- './backup/:/backup/'
Or execute docker-compose up -d with the following docker-compose.yml and backup.sh.
version: '3'
services:
backup:
image: 'jumpaku/backup-with-nextcloud'
environment:
- 'NC_URL=http://nextcloud.example.com/remote.php/webdav/'
- 'NC_USER=nc_user'
- 'NC_PASSWORD=nc_password'
volumes:
- './backup.sh:/backup.sh:ro'
- './backup-from/:/backup-from/'
#!/bin/bash
cp -Rf /backup-from/* /backup/
Execute docker-compose -f ./test/docker-compose.yml up --build -d, wait for a while, and check as follows:
docker-compose -f ./test/docker-compose.yml exec backup cat /backup/date.txt
# => Tue Sep 3 03:59:01 UTC 2019
docker-compose -f ./test/docker-compose.yml exec nextcloud cat ./data/admin/files/date.txt
# => Tue Sep 3 03:59:01 UTC 2019
Content type
Image
Digest
Size
143.3 MB
Last updated
about 6 years ago
docker pull jumpaku/backup-with-nextcloud