Skip to content

Instantly share code, notes, and snippets.

@jeanatcismet
Created March 12, 2019 17:52
Show Gist options
  • Save jeanatcismet/096ecafc0cdabf163e8e0257a31ea7eb to your computer and use it in GitHub Desktop.
Save jeanatcismet/096ecafc0cdabf163e8e0257a31ea7eb to your computer and use it in GitHub Desktop.
using docker container (farmcoolcow/rclone) for mounting a remote rclone directory into a local directory
#!/bin/sh
RCLONE_CONF=$1
RCLONE_SRC=$2
RCLONE_MOUNT_POINT=$3
CONTAINER_NAME=rclone_mount
USER=$(whoami)
exit_script() {
sudo umount $RCLONE_MOUNT_POINT
}
trap exit_script INT TERM
docker run -t --rm --name $CONTAINER_NAME \
-e PUID=$(id -u $USER) \
-e PGID=$(id -g $USER) \
-v $RCLONE_CONF:/home/.rclone.conf \
--mount type=bind,source="$RCLONE_MOUNT_POINT",target=/data,bind-propagation=shared \
--device /dev/fuse \
--privileged \
farmcoolcow/rclone \
mount $RCLONE_SRC /data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment