How to make a file available to a plugin

I want to install the rclone Docker Volume Plugin (which uses a control file, typically rclone.conf). I already have this file. The folder location for this control file can be provided when the plugin is installed (and needs to exist) - see the config & cache parameters below:

docker plugin install rclone/docker-volume-rclone:amd64 --alias rclone --grant-all-permissions args=“-v --allow-other” config=“xxxx” cache=“xxx”

I’m running Windows 10 w/WSL2 enabled. I confess it’s unclear to me how I setup a folder from my Windows filesystem that can be shared with Docker Desktop. All the docs refer to mounts/binds for user containers rather than Docker itself.

Thanks in advance

I’m not sure how plugins work in Docker Desktop, but if you can install a plugin and all your problem is that you need to access a config file, WSL2-based Docker Desktop let’s you access everything on the host basically to which you have access anyway.

The following command is just to list the folders:

docker run --rm -it -privileged --pid host ubuntu:22.04 nsenter -m -t 1 ls /mnt/host

In my case it shows “c e wsl wslg” and the first two are the drive letters. So I guess you could save the config at C:\Users\username\config and refer to it as “/mnt/host/c/Users/username/config

Thanks for this. I’ve since tried providing a folder path using this format “/mnt/host/C/rcloneX” but see the following:

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting “/mnt/host/C/rcloneX/” to rootfs at “/data/config”: stat /mnt/host/C/rcloneX/: no such file or directory: unknown

Now this may be an issue with the rclone plugin (and I’ve posed the same question in their forum) but I also wonder whether there’s something different about plugins & perhaps they behave differently from other containers with respect to access to the host filesystem ?

The first thing I notice is that you used the C as uppercase, but the Linux filesystem is not case insensitive, so you should try with lowercase “c”.

Thanks Akos. I renamed my folder to all lowercase and used c not C for the drive. Same result though…

docker plugin install rclone/docker-volume-rclone:amd64 --alias rclone --grant-all-permissions args=“-v --allow-other” config=“/mnt/host/c/rclonex/” cache=“/mnt/host/c/rclonex/”
amd64: Pulling from rclone/docker-volume-rclone
Digest: sha256:64764bd9c44dfd51493053b2bb01c4d195508dc3e27205a8ca3aaa18d1e7e7d7
b3ccc0a5dd52: Complete
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting “/mnt/host/c/rclonex/” to rootfs at “/data/config”: stat /mnt/host/c/rclonex/: no such file or directory: unknown

I checked, the plugin runs in the same container in which the docker daemon, so the problem could be that rclone requires a local folder, not a remote and what we tried, would have been a remote. I used rclone about a year ago and I don’t remember all the configurations, but you can create a Docker volume, copy your config to that volume and specify that for the plugin.

docker volume create rclone-plugin
docker run --rm -v /c/rclonex:/data -v rclone-plugin:/volume bash cp -R /data/. /volume/. 
docker plugin install rclone/docker-volume-rclone:amd64 --alias rclone --grant-all-permissions args="-v --allow-other" config="/var/lib/docker/volumes/rclone-plugin/_data" cache="/var/lib/docker/volumes/rclone-plugin/_data"

i wouldn’t use volumes this way, but I couldn’t find other ways and it at least proves that it can work, but it requires a local folder in the VM

Note: Please use the code blocks next time as I did, following this guide: How to format your forum posts

1 Like

That code example is much appreciated. Thank-you for spending the time to craft & share it.

How do I mark this as resolved ?

It works so I am very happy. Thanks again

Some of the categories doesn’t allow us to mark a topic as solved. It looks like Docker Desktop for Windows is that kind of category. I can’t change that, but one day we will have to overview these issues.

Until that you can like individual posts if you want to by clicking on the heart icon on the left side under the posts.

Just for completeness, and in case it helps anyone else.

I had also posed my original question in an rclone forum here.

Thanks to a post there, it seems that the correct way to reference a Windows host file (as seen by Docker Desktop/Win) is as follows (for C:drive):

/run/desktop/mnt/host/c/folder_name

I’ve tested this and the mount for the rclone Docker Volume Plugin now works - even using a mixed case Windows folder name.

Thanks again.

1 Like

Thank you for sharing it! I didn’t know about this. This is another difference between Docker Desktop on Windows and on other operating systems. There is no /run/desktop/mnt folder on macOS.