My Raspberry Pi camera is running on my RP3 and works fine. I am trying to run it inside a docker container, but I keep running into the * failed to open vchiq instance error.

This is my Dockerfile

FROM resin/rpi-raspbian:latest

RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y wget
RUN apt-get install libraspberrypi-bin -y
RUN usermod -a -G video root

RUN apt-get -q update \
  && apt-get -qy install \
    curl \
    debootstrap \
    python3 \
    python3-pip \
    ca-certificates \
  && rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /requirements.txt

RUN pip3 install -r requirements.txt

COPY ./src /src

ENTRYPOINT ["/bin/bash"]

and this is the simple Python script I am trying to run (right now, without a volume):

import datetime

from picamera import PiCamera
from time import sleep

camera = PiCamera()

while True:
    now = str(datetime.datetime.now())
    print("Capturing at:", now)
    camera.capture('~/data/images/' + now + '.jpg')

My problem is identical if I try to run other Docker images based off other builds, e.g. this repo.

I have tried to add root to the video group RUN usermod -a -G video root both under build and when running the container. I have tried to run the container with --device /dev/vchiq added to docker run, but I simply get Command not found: --device when doing so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.