Using the Python API inside a docker container with a NON-root user, I get the following output when trying to open the camera object:
CAMERA FAILED TO SETUP
When the same attempt is performed with root, the output is SUCCESS.
Steps to reproduce
Create a docker image from the official stereolabs zed image, and add a user with sudo priviledges. Then add permissions for the zed folder and python libraries.
The following Dockerfile is suggested.
FROM stereolabs/zed:3.8-devel-cuda11.7-ubuntu20.04
ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
RUN chmod -R 777 /usr/local/zed/
RUN chmod -R 777 /usr/local/lib/python3.8/dist-packages/
WORKDIR /home/user
USER user
Save in a file called Dockerfile and build with:
docker build -f Dockerfile -t zed:test .
Then open the console in the docker container with GPU capabilities:
Hey, thanks for the provided information. I have an additional issue. I applied the provided solution and the container runs smoothly on my developer computer. Unfortunately if I run it on our deployment computer I get the following error:
[zed_wrapper-1] Error opening camera: CAMERA NOT DETECTED
[zed_wrapper-1] Please verify the camera connection
[zed_wrapper-1] ZED activation interrupted by user.