From 9dc6b44ced1560fd14c6c3b80619dcb04e2f1fce Mon Sep 17 00:00:00 2001 From: Elias Benbourenane Date: Sun, 10 Nov 2024 19:14:48 -0500 Subject: [PATCH] docs: added an example docker compose with best practices for sharing rclone mounts to other docker container --- docs/content/install.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/content/install.md b/docs/content/install.md index d5be63cba..fbfa79293 100644 --- a/docs/content/install.md +++ b/docs/content/install.md @@ -307,6 +307,33 @@ ls ~/data/mount kill %1 ``` +### Docker compose mount {#docker-compose-mount} + +Here is an example of how to start an rclone mount in a Docker container using Docker Compose. This example also demonstrates how to correctly share the mount with other services running in different containers. It is important to bind the rclone mount with `rshared` on the rclone container and `rslave` on the other services using the mount to prevent the fuse mount from becoming stale. + +```yaml +services: + rclone: + image: rclone/rclone:latest # can also be `beta`, `1.49.1`, etc. + command: mount dropbox:Photos /data + user: ${PUID}:${PGID} # you can find your UID and GID with `id -u` and `id -g` + volumes: + - /mnt/Photos:/data:rshared # shares the rclone mount with the host at /mnt/Photos + - /etc/passwd:/etc/passwd:ro # needed for fuse to work + - /etc/group:/etc/group:ro # needed for fuse to work + devices: + - /dev/fuse + cap_add: + - SYS_ADMIN + security_opt: + - apparmor:unconfined + + some_servie_that_uses_the_mount: + image: some_image + volumes: + - /mnt/Photos:/mnt/Photos:rslave # note that `rslave` is necessary to prevent the fuse mount from going stale +``` + ## Snap installation {#snap} [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/rclone)