Getting the most out of Docker support services we will look deeper into Rclone docker access tools and the command-line interface article. Bobcares will help you with detailed notes and solutions about Rclone and the other docker services.
Rclone docker Overview
Rclone is a function to synchronize the files and directories to and from different cloud storage providers. Usually, the Rclone maintains a docker image and these images are auto-built by the docker hub from the Rclone source based on a minimal Alpine Linux image.
$ docker pull rclone/rclone:latest
latest: Pulling from rclone/rclone
Digest: sha256:0e0ced72671989bb837fea8e88578b3fc48371aa45d209663683e24cfdaa0e11
...
$ docker run --rm rclone/rclone:latest version
rclone v1.49.1
- os/arch: linux/amd64
- go version: go1.12.9
Copy Code
The given”
:latest
Copy Code
“tag will always point you to the latest stable release. You can use the”:beta
Copy Code
“tag to get the latest build from master. Some of the version tags used are:1.49.1
Copy Code
, :1.49
Copy Code
or:1
Copy Code
.
Script installation
You can now install a Rclone on Linux/macOS/BSD, simply run the following command on your OS systems:
sudo -v ; curl https://rclone.org/install.sh | sudo bash
Copy Code
For beta function installation, you can go through the command:
sudo -v ; curl https://rclone.org/install.sh | sudo bash -s beta
Copy Code
The script checks the version of Rclone installed first and if the version is already present then it won’t re-install if not required.
There are a further few command line options to consider when starting a Rclone Docker from the Rclone image.
- You need to mount the host Rclone config directory ”
” in the Docker container. Additionally need to mount a host data directory i.e:/config/rclone
Copy Code
into the Docker container./data
Copy Code
- By default, the Rclone binary inside a Docker container runs with UID=0 which is meant to be root. As the result, all files created by the run module will have UID=0. If the config and data files are shown as non-root UID: GID then you further need to pass them on to the container start command line.
- To access the RC interface either via the API or through the Web UI, need to set the
to--rc-addr
Copy Code
in order to connect from the outside container.:5572
Copy Code
- It is achievable to use
inside a userspace Docker container, and disclose the resulting fuse mount to the host. The exactrclone mount
Copy Code
function might vary slightly between hosts. Further, you also need to mount the hostdocker run
Copy Code
and/etc/passwd
Copy Code
for the fuse to work within the container./etc/group
Copy Code
Here are a few sample commands that have been tested on an Ubuntu 18.04.3 host:
# config on host at ~/.config/rclone/rclone.conf
# data on host at ~/data
# make sure the config is ok by listing the remotes
docker run --rm \
--volume ~/.config/rclone:/config/rclone \
--volume ~/data:/data:shared \
--user $(id -u):$(id -g) \
rclone/rclone \
listremotes
# perform mount inside Docker container, expose result to host
mkdir -p ~/data/mount
docker run --rm \
--volume ~/.config/rclone:/config/rclone \
--volume ~/data:/data:shared \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro --volume /etc/group:/etc/group:ro \
--device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \
rclone/rclone \
mount dropbox:Photos /data/mount &
ls ~/data/mount
kill %1
Copy Code
Container Usage
This container usage will Interactively Create the Rclone docker configuration. Have a further look at the few examples provided:
[gdrive]
type = drive
client_id = 9812619862124-kjsadfkjasdflkjashdfkljashfkadjh.apps.googleusercontent.com
client_secret = KaJadHasdGAqafhKJUoakaGs
scope = drive
hdlkahsdlkhiuhgsiKJHSA_jkasdkjhaskjha_qe","expiry":"2018-06-14T10:13:20.424623462Z"}
team_drive = 0AaskdjhasKJGaskjdh
[gcache]
type = cache
remote = gdrive:
chunk_size = 5M
info_age = 1d
chunk_total_size = 1G
[gcache-crypt]
type = crypt
remote = gcache:
filename_encryption = standard
directory_name_encryption = true
password = lakldhfkuhaehadf7hkajdfhl29hrkljhasd9hDFKHASEDFMN.O3RNDLF8ADFLK3LIHslhD97HFADONLKLNkjHkljhlkjhfknadofadflkjqlkasd
password2 = adlkfhadflakhdf98had87hih&HKjhaslhsadkjgo8gi7KJlkjglgfG&aslkdhlkjgkljGLKJGSADkjhlkhasdlkhasd
[gdrive-crypt]
type = crypt
remote = gdrive:
filename_encryption = standard
directory_name_encryption = true
password = lakldhfkuhaehadf7hkajdfhl29hrkljhasd9hDFKHASEDFMN.O3RNDLF8ADFLK3LIHslhD97HFADONLKLNkjHkljhlkjhfknadofadflkjqlkasd
password2 = adlkfhadflakhdf98had87hih&HKjhaslhsadkjgo8gi7KJlkjglgfG&aslkdhlkjgkljGLKJGSADkjhlkhasdlkhasd
Copy Code
Consequently, Mount a remote drive
docker run --privileged \
-v $(pwd)/config:/config \
-v $(pwd)/mnt:/mnt:shared \
--env CONFIG="--config /config/rclone.conf" \
--env SUBCMD="mount" \
--env PARAMS="--allow-other --allow-non-empty gcache-crypt: /mnt/" lucashalbert/rclone
Copy Code
Now copy the files from the local system to remote
docker run --privileged \
-v $(pwd)/config:/config \
-v $(pwd)/mnt:/mnt:shared \
--env CONFIG="--config /config/rclone.conf" \
--env SUBCMD="copy" \
--env PARAMS="-v /mnt/Pictures gdrive-crypt:/Pictures"
Copy Code
Finally, access to the SSH while the Rclone container is running.
docker exec -it rclone sh
Copy Code
Environment Variables / Parameters
Variable | Example | Description |
---|---|---|
SUBCMD | mount | Rclone subcommand (see subcommands section of Rclone documentation) |
CONFIG | –config /config/rclone.conf | Location of the Rclone configuration file |
PARAMS | –allow-others –allow-non-empty | Options to be passed to rclone |
Conclusion:
The Rclone tool is highly useful for keeping the directories synced and for migrating data between the storage platforms. This is a Go program that comes as a single binary file, helpful for Rclone daily sync and also used for scheduling a job.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments