1

With Ubuntu, USB drives are automatically mounted at /media/<user>/<drive> when they are plugged in. I wanted to use this to make newly connected USB drives available in a running Docker container. So I used -v /media/<user>:/media/<user> to mount the whole parent directory of the USB mount points to the container.

This works well if the USB drive was connected before the container starts. In this case the USB mount point has permissions 0777 and belongs to <user>. If a USB drive is connected when the container is already running, the mount point appears in the container but has permissions 0700 and is owned by root instead!

Can anyone shed some light on what is possibly happening here? I can imagine that the USB drives are automatically mounted as 0700 belonging to root by default and afterwards some other mechanism kicks in to change this to 0777 and <user>. Only the change is not picked up by Docker. Is this true?

I already digged through tons of forum threads and mailing lists but couldn't figure out the mechanism. I also tried some udev rules (like this one) but these had no effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.