Help
docker run --rm sstc/rsync
Version
docker run --rm sstc/rsync --version
Change entrypint
docker run --rm --entrypoint=which sstc/rsync rsync
Sync local to local
LOCAL_PATH=/from/path
DIST_PATH=/to/path
docker run --rm \
-v $LOCAL_PATH:/app \
-v $DIST_PATH:/app_dist \
sstc/rsync \
-av /app/ /app_dist/
Sync local to remote
LOCAL_PATH=/from/path
REMOTE_PATH=/remote/path
USER=username
HOST=remote.domain.or.ip
PORT=22
docker run --rm \
-v ${LOCAL_PATH}:/app \
-v ~/.ssh:/root/.ssh \
sstc/rsync \
-avz -e "ssh -p${PORT}" /app/ ${USER}@${HOST}:${REMOTE_PATH}/
Due to https://github.com/docker/docker/issues/2259
we can:
-e "ssh -F /dev/null"
to force rsync not read the config.- or
-v /root/.ssh:/root/.ssh
mount root config instead! - or
-v ~/.ssh/id_rsa:/root/id_rsa
only mount the key file.