Introduction
Nextcloud supports external storage. We will be adding to its external storage via this path:
Docker volume plugin β rclone plugin β rclone config with remote β docker-compose.yaml volume section β docker-compose.yaml services volume mounting section β nextcloud webUI.
Steps
- Create config with whatever backend you want
rclone config -
sudo mkdir -p /var/lib/docker-plugins/rclone/config
andsudo mkdir -p /var/lib/docker-plugins/rclone/cache
- Copy that conf file into the
/var/lib/docker-plugins/rclone/config
directory. -
docker plugin install rclone/docker-volume-rclone:amd64 args="-v" --alias rclone --grant-all-permissions
andsudo docker plugin enable rclone
- Add this into the volume section of the compose file for nextcloud. Tweak values as needed.
${volume_name}:
driver: rclone
driver_opts:
remote: '${your_remote}:'
allow_other: 'true'
vfs_cache_mode: full
poll_interval: 0
umask: 000
- note, I have only tried the
umask: 000
option and nothing else. Perhaps something like776
will work, but too lazy to try.
- Mount the volume into the nextcloud service:
volumes:
- nextcloud:/var/www/html
- ${your_remote}:/some_path_you_want
- Restart container:
sudo docker compose restart
- Install nextcloud external storage app.
Configuring External Storage (GUI) β Nextcloud latest Administration Manual latest documentation - Nextcloud β Settings β Administration β External storage. Add parameters.
Beware
- File edit appearances will be slow, but they will happen at the end.
- Letβs hope this post will not be deleted - Creation of a directory called www
- Have not been met with
Transport endpoint not connected
error yet when rclone mount is managed via docker plug in, comment below if you have any. - You can fiddle with the other settings for performance in regards to
vfs
, but I donβt think there is a need if you are just serving the external storage to be downloaded and uploaded.
Demonstration
$ sudo docker exec -it nextcloud /bin/bash -c 'ls -hal /mounted/path'
total 4.0K
drwxrwxrwx 1 root root 0 Jun 15 23:02 .
drwxrwxrwx 16 www-data root 4.0K Jun 15 22:59 ..
drwxrwxrwx 1 root root 0 Jun 15 23:05 Folder
drwxrwxrwx 1 root root 0 Jun 15 23:13 www
References
If you need to make a volume by itself.
I donβt think you need to run the php occ
command at all, nextcloud will be slower but it will eventually update the external storage.
No amount of work done in a container can change permissions, only the options at the creation of the volume can.