Sitemap
Jan Chęć

Jan Chęć

Docker — using webcam

1 min readApr 18, 2018

Add to docker-compose:

devices:
- /dev/video0:/dev/video0

Or append to your docker run command: --device=/dev/video0:/dev/video0 .

Get Jan Chęć’s stories in your inbox

Join Medium for free to get updates from this writer.

If you’re using a non-root user in Docker, they won’t have a permission to use /dev/video0. But this device-file will be available only after starting a container, so you can’t chmod it in the Dockerfile. But you can add the user to video group which does the trick:

RUN sudo usermod -a -G video developer

Voila!

The similar scenario should be used in many (all?) of the device cases: add a path to it in docker-compose or docker run command. Then check what group does the device have and add the user to it.

--

--