Configuring docker dynamic USB memory access with --mount option in VS Code Torizon Extension

Dear Toradex Community,

the --volume option seems not enough to dynamically mount and unmount USB drives and sticks in a docker containers when they are physically plugged and unplugged as mentioned here on serverfault.com. Therefore it is possible to do that using the more powerful --mount option this way:

docker run --rm -it --privileged --mount type=bind,source=/var/rootdirs/media,target=/disks,bind-propagation=shared  torizon/debian:$CT_TAG_DEBIAN /bin/bash

Unfortunately I am not able to configure that option in VS Code. On February I asked an other question about other simpler docker options and the answer was general enough to solve similar issues, but now I am blocked again because the option argument is more complex, being a list of Mounts objects, according to the documentation (link).

Some unsuccessful attempts results in similar config.yaml

extraparms:
    common:
        mounts: type=bind,source=/var/rootdirs/media,target=/disks,bind-propagation=shared
        mounts: '[type=bind,source=/var/rootdirs/media,target=/disks,bind-propagation=shared]'

But no way to make it working. How can I configure it correctly in Torizon VS Code Extension?

Thank you in advance and best regards,

ldvp

Greetings @ldvp,

The value here should be this I believe:
[{ type: "bind", source: "/media", target: "/media", propagation: "shared" }]

Adjust the source/target to your needs but the general format above should be correct.

One thing you need to make sure of is that the value is proper yaml since this gets written to config.yaml. Which then gets parsed by the backend.

Give this a try and let me know how it works out.

Best Regards,
Jeremias

The information provided is helpful.

to accomplish what i’m after requires an entry under “extraparams”.

In VSCode, when i go to Configurations-extraparams, i’m propmted for a ‘key’ then a ‘Value’. Same with Configurations-Volumes, i’m propmted for a ‘key’ then a ‘value’

Dear Jeremias,
the described method helped me to see the flash drive, but it is connected only with “root” rights and therefore I cannot write to it. Can you advise me how to get the right one for the “user”? Thank you

Best regards
Richard

Hi @Richard !

Which version of TorizonCore are you using?

Best regards,

Dear Henrique,
I have TorizonCore 5.7.0+build.17, I use VS Code with the Toradex Extension and I found that the propagation: “shared” flag from config.yaml is not propagated to the resulting config.v2.json in the appropriate container.

My evaluation board is Ixora V1.2 with iMX8QM

Best regards,
Richard

Hi @Richard ,

Thanks for the Torizon version.

Can you explain or share where this config.v2.json is coming from?

What version of the module do you have there?

Best Regards
Kevin

Hello @Richard ,
We didn’t receive any answer to @kevin.tx 's questions.
Were you able to solve your issue?

Best regards,
Josep