jshridha/docker-motioneye

video0 permission denied

Closed this issue · 5 comments

Cant use your docker. Permission denied on device video0

docker logs motioneye
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/20_setup_motion.sh...
ownership of ‘/config/motion.conf’ retained as nobody:users
ownership of ‘/config/motioneye.conf’ retained as nobody:users
ownership of ‘/config/prefs.json’ retained as nobody:users
ownership of ‘/config’ retained as nobody:users
mode of ‘/config’ retained as 0775 (rwxrwxr-x)
mode of ‘/config/motion.conf’ retained as 0775 (rwxrwxr-x)
mode of ‘/config/motioneye.conf’ retained as 0775 (rwxrwxr-x)
mode of ‘/config/prefs.json’ changed from 0644 (rw-r--r--) to 0775 (rwxrwxr-x)
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 20
Oct  5 20:08:00 5518f14a126f syslog-ng[29]: syslog-ng starting up; version='3.5.3'
    INFO: hello! this is motionEye server 0.33.2
    INFO: cleanup started
    INFO: wsswitch started
    INFO: tasks started
    INFO: mjpg client garbage collector started
    INFO: server started
Failed to open /dev/video0: Permission denied
timemachine:
    container_name: motioneye
    image: jshridha/motioneye:latest
    environment:
      - TIMEZONE="Europe/Berlin"
    volumes:
      - /root/.motioneye:/config
      - /media/19ad4901-a651-4001-9306-425956e2c501/Motioneye:/home/nobody/media
    ports:
      - "8081:8081"
      - "8765:8765"
    devices:
      - "/dev/video0:/dev/video0"
ls -la /dev/video0
crw-rw----+ 1 root video 81, 0 Okt  5 21:43 /dev/video0

Sorry it has taken me a while to get to this issue. It sounds like the user running motion does not have permission to access the device.

Can you try the newest build jshridha/motioneye:experimental specifying the env variables:

environment:
  - PUID="UID"
  - PGID="GID"

where UID and GID specify a user/group that has access to the /dev/video0 device. The defaults are PUID=99 and PGID=100

Workaround is to use -e PUID="0" and -e PGID="0" instead.

@volker-fr is right. Closing this issue.

@jshridha I don't think a workaround is a fix. And this workaround also doesn't seem to be documented outside of this ticket.