rsync is an open source utility that provides fast incremental file transfer.
If you are into Dockerizing everything or you just want to have a better view over the rsync process (e.g., to see it in your cluster visualizer), this repository provides you with a Docker image to run the rsync process.
The provided image is open-source and built from scratch with the goal to enable you to run a stateless and an immutable container, according to the best practices.
With this image you can:
Supported architectures:
x86-64 and arm32ogivuk/rsync:latest, the correct image for your architecture will be retreived| Tag | Transmission Version and Architecture |
|---|---|
:latest | supports both x64 and arm32v7 architectures |
:x64 | targeted to the x64 architecture |
:arm32v7 | targeted to the arm32v7 architecture |
The image is based on alpine image and it includes:
rsyncopenssh-client for remote sync over sshtzdata for easier setting up of local timezone (for file timestamps)cron (included in the alpine) for scheduling regular back-upsrsync.sh script that prepares the cron job and starts the cron daemondocker run --rm \
--name=rsync \
--volume /path/to/source/data:/data/src \
--volume /path/to/destination/data:/data/dst \
ogivuk/rsync [OPTIONS] /data/src/ /data/dst/
Replace:
/path/to/source/data with the source folder to be copied or backed-up/path/to/destination/data with the destination folder[OPTIONS] with desired rsync optional argumentscreate a folder, for example ~/rsync, that will be later mounted in the container
logs, for example ~/rsync/logs is suggested for the log filesmkdir -p ~/rsync/logs
~/rsync with any other desired locationrun as a container:
docker run --rm \
--name=rsync \
--env TZ="Europe/Zurich" \
--env RSYNC_CRONTAB="crontab" \
--volume ~/rsync:/rsync
--volume /path/to/source/data:/data/src \
--volume /path/to/destination/data:/data/dst \
ogivuk/rsync
run as a swarm service:
docker service create \
--name=rsync \
--env TZ="Europe/Zurich" \
--env RSYNC_CRONTAB="crontab" \
--mount type=bind,src=~/rsync,dst=/rsync \
--mount type=bind,src=/path/to/source/data,dst=/data/src \
--mount type=bind,src=/path/to/destination/data,dst=/data/dst \
ogivuk/rsync
| Parameter | Explanation | When to Use |
|---|---|---|
--env TZ="Europe/Zurich" | Sets the timezone in the container, which is important for the correct timestamping of logs. Replace Europe/Zurich with your own timezone from the list of available timezones. | Always |
--env RSYNC_CRONTAB="crontab" | Specifies that the rsync is to be run as one or multiple cron jobs, and that the jobs are defined in the crontab file located in the mount-binded ~/rsync folder. The rsync parameters used in the crontab must be mindful of the data locations in the container. | When using cron for regular rsync jobs |
~/rsync | Specifies the local folder ~/rsync that is mounted to the container at /rsync. Change ~/rsync if another location is chosen in Step 1. | When using cron or ssh |
/path/to/source/data | Specifies the source folder for sync and is mounted to the container at /data/src. Change to the appropriate folder. Multiple folders can be mounted in this way. | If any source is local |
/path/to/destination/data | Specifies the destination folder for sync and is mounted to the container at /data/src. Change to the appropriate folder. Multiple folders can be mounted in this way. | If any destination is local |
--env RSYNC_UID=$(id -u) | Provides the UID of the user starting the container so that the ownership of the files that rsync copies belong to that user. | If the rsync option for preserving ownership is not selected |
--env RSYNC_GID=$(id -g) | Provides the GID of the user starting the container so that the ownership of the files that rsync copies belong to that user group. | If the rsync option for preserving ownership is not selected |
Remarks:
~/rsync/ssh/ssh_config file-e "ssh -F /rsync/ssh/ssh_config" instructs rsync to use the ssh with the ssh_config for the remote syncContent type
Image
Digest
Size
4.3 MB
Last updated
over 6 years ago
docker pull ogivuk/rsync