This Docker container is designed to run Rclone with a high degree of customization.
379
Github: https://github.com/Austinwenyz/rclone-backup/ Docker Hub: https://hub.docker.com/r/austinwenyz/rclone-backup/
This is a lightweight Docker image based on Alpine Linux, designed for file backup and synchronization using Rclone. It supports scheduled tasks and immediate execution, allowing easy backup of local files to various cloud storage services.
docker-compose.yml with the following content:version: '3'
services:
rclone-backup:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backup
restart: always
volumes:
- ${dataPath}:/data
- ${configPath}:/config/rclone.conf
environment:
- CRON_SCHEDULE=0 3 * * *
- RCLONE_COMMAND=ls /data/config --progress
- RUN_NOW=true
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
rclone-backupMore:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backupMore
restart: always
volumes:
- ${dataPath}:/data
- ${configPath}:/config/rclone.conf
environment:
- CRON_SCHEDULE=0 3 * * *
- RCLONE_COMMAND=ls 123Pan:/SYNC/ --progress
- RUN_NOW=true
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
Replace ${dataPath} with the local data directory you want to back up, and ${configPath} with the path to your Rclone configuration file. Alternatively, define them directly in the env file (recommended).
Modify the CRON_SCHEDULE and RCLONE_COMMAND environment variables as needed, representing the scheduled task time and the Rclone command to run, respectively.
Start the containers by running the following command:
docker-compose up -d
docker-compose logs -f
CRON_SCHEDULE: Time for scheduled tasks in cron expression format, default is empty (no scheduled task).RCLONE_COMMAND: Rclone command to run, default is rclone version.RUN_NOW: Whether to execute the Rclone command once immediately when the container starts. Set to true to enable, default is false./data: Mounted local data directory for backup./config/rclone.conf: Mounted path to the Rclone configuration file.The container uses the json-file logging driver, storing log files in the /var/log/rclone directory inside the container. Each log file is limited to 10MB, with a maximum of 3 log files retained.
Here are some usage examples:
/home/user/data directory to a remote storage named remote every day at 3 AM:version: '3'
services:
rclone-backup:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backup
restart: always
volumes:
- /home/user/data:/data
- /home/user/.config/rclone/rclone.conf:/config/rclone.conf
environment:
- CRON_SCHEDULE=0 3 * * *
- RCLONE_COMMAND=rclone copy /data remote:/backup --progress
/home/user/data directory to a remote storage named remote immediately upon container startup:version: '3'
services:
rclone-backup:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backup
restart: always
volumes:
- /home/user/data:/data
- /home/user/.config/rclone/rclone.conf:/config/rclone.conf
environment:
- RCLONE_COMMAND=rclone sync /data remote:/backup --progress
- RUN_NOW=true
This project is released under the MIT License.
这是一个基于Alpine Linux的轻量级Docker镜像,用于使用Rclone进行文件备份和同步。它支持定时任务和即时运行,可以方便地将本地文件备份到各种云存储服务。
docker-compose.yml的文件,内容如下:version: '3'
services:
rclone-backup:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backup
restart: always
volumes:
- ${dataPath}:/data
- ${configPath}:/config/rclone.conf
environment:
- CRON_SCHEDULE=0 3 * * *
- RCLONE_COMMAND=ls /data/config --progress
- RUN_NOW=true
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
rclone-backupMore:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backupMore
restart: always
volumes:
- ${dataPath}:/data
- ${configPath}:/config/rclone.conf
environment:
- CRON_SCHEDULE=0 3 * * *
- RCLONE_COMMAND=ls 123Pan:/SYNC/ --progress
- RUN_NOW=true
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
替换${dataPath}为你要备份的本地数据目录,${configPath}为你的Rclone配置文件路径。或者直接在env文件中定义(推荐)
根据需要修改CRON_SCHEDULE和RCLONE_COMMAND环境变量,分别表示定时任务时间和要运行的Rclone命令。
运行以下命令启动容器:
docker-compose up -d
docker-compose logs -f
CRON_SCHEDULE: 定时任务的时间,格式为cron表达式,默认为空(不运行定时任务)。RCLONE_COMMAND: 要运行的Rclone命令,默认为rclone version。RUN_NOW: 是否在容器启动时立即执行一次Rclone命令,设置为true启用,默认为false。/data: 挂载的本地数据目录,用于备份。/config/rclone.conf: 挂载的Rclone配置文件路径。容器使用json-file日志驱动,日志文件存储在容器内的/var/log/rclone目录下。单个日志文件最大为10MB,最多保留3个日志文件。
以下是一些使用示例:
/home/user/data目录备份到名为remote的远程存储:version: '3'
services:
rclone-backup:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backup
restart: always
volumes:
- /home/user/data:/data
- /home/user/.config/rclone/rclone.conf:/config/rclone.conf
environment:
- CRON_SCHEDULE=0 3 * * *
- RCLONE_COMMAND=rclone copy /data remote:/backup --progress
/home/user/data目录同步到名为remote的远程存储:version: '3'
services:
rclone-backup:
image: austinwenyz/rclone-backup:latest
container_name: rclone-backup
restart: always
volumes:
- /home/user/data:/data
- /home/user/.config/rclone/rclone.conf:/config/rclone.conf
environment:
- RCLONE_COMMAND=rclone sync /data remote:/backup --progress
- RUN_NOW=true
本项目基于MIT许可证发布。
Content type
Image
Digest
sha256:3e540c478…
Size
23.4 MB
Last updated
over 2 years ago
docker pull austinwenyz/rclone-backup