docs: added an example docker compose with best practices for sharing rclone mounts to other docker container

This commit is contained in:
Elias Benbourenane 2024-11-10 19:14:48 -05:00
parent ee72554fb9
commit 9dc6b44ced
No known key found for this signature in database
GPG Key ID: 211BA8E32C1C8BD5

View File

@ -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)