Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document mounting a device such as a USB to a running container #20821

Open
moxiegirl opened this issue Mar 1, 2016 · 3 comments
Open

Document mounting a device such as a USB to a running container #20821

moxiegirl opened this issue Mar 1, 2016 · 3 comments

Comments

@moxiegirl
Copy link
Contributor

I have a local Ubuntu 12.04 machine that I want to run Docker on with some application code. However the code needs to read data off of a USB drive when it is plugged in. Because the drive can be swapped, it seems like volume mounting it does not work when the new one is plugged in. Is there a way to configure Docker so that the usb detection is passed to Docker instead of just the host os?

Use docker run command and discussed here:

https://docs.docker.com/engine/reference/run/#volume-shared-filesystems

You can mount /dev using the -v flag. Any device that appears on /dev will show up in the container. If you do this, you'll likely also want to change the cgroup value to restrict the permissions to just the USB device.

Jerome in our company also wrote this blog on doing this:

https://jpetazzo.github.io/2015/01/13/docker-mount-dynamic-volumes/

@phemmer
Copy link
Contributor

phemmer commented Mar 1, 2016

While not a documentation change, something that might be nice is that if the container is launched with --privileged, that /dev be mounted as devtmpfs instead of normal tmpfs where the devices are manually populated by docker. With devtmpfs, the kernel will automatically add/remove entries to /dev as devices are added and removed.

@thaJeztah
Copy link
Member

@mstanleyjones do you know if this was updated in the documentation?

@mdlinville
Copy link
Contributor

I doubt it!

@mdlinville mdlinville self-assigned this Oct 19, 2016
@mdlinville mdlinville removed their assignment Feb 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants