Docker image to sync your google drive
MIT License
This docker image uses rclone to continuously sync your google drive data to a specific directory. It's also possible to sync changes back to google drive.
docker run --rm \
--log-opt max-size=10m \
-v <host/path/to/offline/folder>:/var/target \
-v <host/path/to/rclone-config/folder>:/root/.config/rclone \
-d \
richardregeer/google-drive-sync
A rclone configuration can be created by running the config command. Make sure you answer 'N' on the autoconfig option. It will give an URL that you can open open in your browser. When you created the config copy it and create a shared volume to use the configuration in the container. For more information howto create rclone configuration see the rclone documentation.
Run the following command to run the rclone configuration in a docker container.
docker run --rm -it \
richardregeer/google-drive-sync \
bash -c 'rclone config && echo -e "\n\n****[ Config file]****" && cat /root/.config/rclone/rclone.conf'
{
"defaultSource": "/",
"defaultSyncOptions": "",
"syncInterval": 60000,
"remotes": [
{
"source": "/test-1",
"name": "google-drive-1",
"destination": "/var/target"
},
{
"source": "/test-2",
"name": "google-drive-2",
"destination": "/var/target",
"syncLocalToRemote": true
}
]
}
It is possible to add multiple remotes. Make sure you also add the remote rclone configuration in the rclone.conf
file with the same name as in the config.json
. The remotes will be synced in sequence and in order of the config.json.
# Use -v to override the default config.json configuration.
# Make sure to target the correct directory in the container.
docker run --rm \
--log-opt max-size=10m \
-v <host/path/to/google-sync-config.json>:/usr/local/bin/google-sync/etc/config.json
-v <host/path/to/offline/folder>:/var/target \
-v <host/path/to/config/folder/rclone.conf>:/root/.config/rclone/rclone.conf \
-d \
richardregeer/google-drive-sync
For development please use make
to see the available tasks
# Show all the available tasks
make
# Install and build the environment
make install
# Start in development mode
make start