A Docker utility to perform a one-way file sync from a remote server (SFTP or SSH) to a local filesystem, with support for multiple source-destination pairs.
There are several ways to run
Regardless how you run it, be sure to mount a host volume at
/dest so the files persist after the container shuts down.
docker run --privileged -v /path/to/docker/volume:/dest \ -e HOST=sourcehost.example.com \ -e USER=remote_user \ -e PASS=remote_user_pass \ -e SYNC_1_SRC=wordress/wp-content/uploads/ \ -e SYNC_1_DEST=uploads/ \ -e SYNC_2_SRC=path/to/another/uploads/folder/ \ -e SYNC_2_DEST=second/uploads/destination/ \ -e DEST_DIR_PERMS=755 \ -e DEST_FILE_PERMS=644 \ -e DEST_GROUP=www-data \ -e DEST_USER=www-data \ klsmith/remote-file-sync
version: '2' services: file-sync: image: 'klsmith/remote-file-sync:latest' environment: - HOST=sourcehost.example.com - USER=remote_user - PASS=remote_user_pass - SYNC_1_SRC=wordress/wp-content/uploads/ - SYNC_1_DEST=uploads/ - SYNC_2_SRC=path/to/another/uploads/folder/ - SYNC_2_DEST=second/uploads/destination/ - DEST_DIR_PERMS=755 - DEST_FILE_PERMS=644 - DEST_GROUP=www-data - DEST_USER=www-data privileged: true volumes: - '/path/to/docker/volume:/dest'
|HOST||Yes||Remote server's hostname.|
|USER||Yes||Username to connect to remote server.|
|PASS||Password to connect to remote server. Required if
|IDENTITY_FILE||Path to private key for authenticating with remote server. Required if
|SYNC_#_SRC||Yes||Remote source path, where # is a positive integer. At least one (
|SYNC_#_DEST||Yes||Local destination path, where # is a positive integer. At least one (
|DEST_DIR_PERMS||Sets Unix permissions on destination directories. e.g.
|DEST_FILE_PERMS||Sets Unix permissions on destination files. e.g.
|DEST_USER||Sets the owner on all destination files and directories. e.g.
|DEST_GROUP||Sets the group on all destination files and directories. e.g.
The container will exit with code 0 when the sync finishes.
- The title explains the issue in just a couple words
- The description is detailed enough and contains at least:
- steps to reproduce the issue
- what the expected result is and what actually happens
- the version of the software being used
- versions of relevant external software (e.g. hosting platform, orchestrator, etc.)
- Explain what you’ve already done trying to fix this issue
- The report is written in proper English
Copyright 2017 Kevin Smith
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.