Francesco Meli
Francesco Meli

Reputation: 2700

mapping all available devices in docker-compose

I have a working docker-compose where I now need to bind not only one specific device but all available devices.

So instead of having something like:

devices
  - '/dev/serial0:/dev/serial0'

I would like to do something like:

devices
  - '/dev:/dev'

This gives me the following error:

container init caused \"rootfs_linux.go:70: creating device nodes caused \\\"open /var/lib/docker/devicemapper/mnt/6a4...05af/rootfs/dev/pts/0: permission denied\\\"\"": unknown

How could I map all devices to my container?

Upvotes: 5

Views: 14874

Answers (1)

Uku Loskit
Uku Loskit

Reputation: 42040

You can achieve this most easily by running a privileged container: e.g compare:

docker run alpine ls -la /dev

vs

docker run --privileged alpine ls -la /dev

Upvotes: 3

Related Questions