Skip to content

Instantly share code, notes, and snippets.

@indzi
Created April 15, 2019 12:56
Show Gist options
  • Save indzi/b63ea2068ae08fbf9468b113b05f1504 to your computer and use it in GitHub Desktop.
Save indzi/b63ea2068ae08fbf9468b113b05f1504 to your computer and use it in GitHub Desktop.
#### Capabilities
Linux capabilities can be set by using `cap-add` and `cap-drop`. See <https://docs.docker.com/engine/reference/run/#/runtime-privilege-and-linux-capabilities> for details. This should be used for greater security.
To mount a FUSE based filesystem, you need to combine both --cap-add and --device:
```
docker run --rm -it --cap-add SYS_ADMIN --device /dev/fuse sshfs
```
Give access to a single device:
```
docker run -it --device=/dev/ttyUSB0 debian bash
```
Give access to all devices:
```
docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb debian bash
```
More info about privileged containers [here](
https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment