A lightweight Docker image for automated file copy operations using Rclone with cron. This image supports both scheduled backups via cron and immediate backups, making it perfect for flexible and reliable cloud storage management.
- Scheduled Backups: Automate file copy operations using the
BACKUP_CRON
environment variable. - Immediate Backups: If
BACKUP_CRON
is not set, the backup runs immediately, and the container exits. - Multi-Cloud Compatibility: Works seamlessly with Rclone-supported cloud storage providers.
- Configurable Time Zone: Use the
TIME_ZONE
variable to set your desired timezone for cron scheduling. - Comprehensive Logs: Real-time and persistent logs for monitoring backup activity.
- Customizable Rclone Options: Add advanced Rclone options for tailored performance.
- Docker installed on your system.
- Rclone configured with necessary remotes (e.g., AWS S3, Google Drive).
Run the container without specifying BACKUP_CRON
to start a backup immediately and stop the container upon completion:
docker run --rm \
-e RCLONE_SOURCE=source:my-source-bucket \
-e RCLONE_DESTINATION=backup:my-destination-bucket \
-e RCLONE_OPTIONS="--progress --checksum" \
-e TIME_ZONE="Asia/Kolkata" \
dharmeshmp/rclone-copy-cron
Specify a BACKUP_CRON
expression to schedule periodic backups:
docker run -d \
-e RCLONE_SOURCE=source:my-source-bucket \
-e RCLONE_DESTINATION=backup:my-destination-bucket \
-e RCLONE_OPTIONS="--progress --checksum" \
-e BACKUP_CRON="0 2 * * *" \
-e TIME_ZONE="Asia/Kolkata" \
dharmeshmp/rclone-copy-cron
version: "3.9"
services:
backup:
image: dharmeshmp/rclone-copy-cron
environment:
- RCLONE_SOURCE=source:my-source-bucket
- RCLONE_DESTINATION=backup:my-destination-bucket
- RCLONE_OPTIONS=--progress --checksum
- BACKUP_CRON=0 2 * * *
- TIME_ZONE=Asia/Kolkata
- RCLONE_CONFIG_SOURCE_TYPE=s3
- RCLONE_CONFIG_SOURCE_PROVIDER=AWS
- RCLONE_CONFIG_SOURCE_ACCESS_KEY_ID=your-access-key
- RCLONE_CONFIG_SOURCE_SECRET_ACCESS_KEY=your-secret-key
Variable | Required | Description | Default |
---|---|---|---|
RCLONE_SOURCE |
✅ | Source path for Rclone to copy files from. | None |
RCLONE_DESTINATION |
✅ | Destination path for Rclone to copy files to. | None |
RCLONE_OPTIONS |
✅ | Additional Rclone options (e.g., --progress --checksum ). |
None |
BACKUP_CRON |
❌ | Cron expression to schedule backups. If not set, the backup runs immediately and exits. | None |
TIME_ZONE |
❌ | Timezone for the container (e.g., Asia/Kolkata , UTC ). |
UTC |
RCLONE_CONFIG_SOURCE_* |
✅ | Configuration for the source remote (e.g., provider, keys, region). | None |
RCLONE_CONFIG_DESTINATION_* |
✅ | Configuration for the destination remote (e.g., provider, keys, region). | None |
Time Zone | Example Value |
---|---|
UTC | UTC |
Asia/Kolkata | Asia/Kolkata |
America/New_York | America/New_York |
- File Logs: Persistent logs are saved in
/var/log/copy.log
inside the container. - Real-Time Logs: Monitor logs in real-time via Docker:
docker logs -f <container-name>
Copy data from an AWS S3 bucket to a DigitalOcean Space every hour with optimized Rclone options.
BACKUP_CRON="0 * * * *"
RCLONE_SOURCE="s3:my-source-bucket"
RCLONE_DESTINATION="do:my-destination-bucket"
RCLONE_OPTIONS="--progress --fast-list --transfers=32 --checkers=64 --checksum"
docker run --rm -it \
-e BACKUP_CRON="0 * * * *" \
-e RCLONE_SOURCE="s3:my-source-bucket" \
-e RCLONE_DESTINATION="do:my-destination-bucket" \
-e RCLONE_OPTIONS="--progress --fast-list --transfers=32 --checkers=64 --checksum" \
dharmeshmp/rclone-copy-cron
This image is open-source and available under the MIT License.
Feel free to open an issue or submit a pull request for improvements!