![]() First of all, lets find cgroup properties of your USB device. Idea is to configure cgroup rules properly. Just follow the instruction line by line, all steps are explained The Safe and Proper way of accessing tty devices without -privileged mode Without doing this, any newly plugged or rebooting device after the container started, will get a new bus ID and will not be allowed access in the container. Then start your container like this: docker run -v /dev/bus:/dev/bus:ro -v /dev/serial:/dev/serial:ro -i -t -entrypoint /bin/bash debian:amd64 It may be different on your system than on mine: echo 'c 188:* rwm' > /sys/fs/cgroup/devices/docker/$A*/devices.allow It's a bit hard to paste, but in a nutshell, you need to get the major number for your character device and send that to cgroup:ฤก88 is the major number of /dev/ttyUSB*, which you can get with 'ls -l'. See details here: Accessing USB Devices In Docker without using -privileged Using the cgroups approach is better in that respect and works on devices that get added after the container as started. Basically this allows the container to gain root on the host, which is usually not what you want. You could just use -v /dev:/dev but that's unsafe as it maps all the devices from your host into the container, including raw disk devices and so forth. You have to use cgroup devices.allow get around it. device works until your USB device gets unplugged/replugged and then it stops working. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |