how to connect a camera in docker

I use pointgrey camera and spinnaker sdk

The connection is fine in xavier host, but the following error is output in docker

$ sudo /usr/bin/SpinVeiw_QT
Invalid MIT-MAGIC-COOKIE-1 keyFatal: (null) ((null):0, QXcbConnection: Could not connect to display :1)

on my personal PC, I connected to camera in docker with the above command

is your camera listed if you execute the command below?

ls /dev/video*

typically to map a camera smth. like the command below is used

--device /dev/video0


My camera is a usb device and the it attached to /dev/bus/usb/002

I think --device option is not a problem

Because I run docker without any difference between the docker run script’s options on the pc.

you also may need to execute

xhost +

and check corresponding parameters e.g.

-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY

you may also check a thread where a similar issue is mentioned; in the latter case they adjusted Xauthoriy which seems resolved the issue
However, it seems that your issue is not how to connect a camera, but how to map a display.

my run script already has


what else does your run script have?
what code do you execute when getting the error?
could you provide the complete docker run sequence?

For USB cameras, we support UVC driver by default. You may check this post

If the cmaera does not support UVC driver and requires additional driver, we would need community to share experience.

I use a grasshopper3 camera and support a USB3.0 cable.

Unfortunately the advice of using UVC driver is not the solution in my case.

my case’s are:

~$ v412-ctl -d /dev/video1/ --list-formats-ext
bash: v412-ctl: command not found

~$ gst-launch-1.0 v412src device=/dev/video1 | video/x-raw format=yuy2,width=848,height=480,framerate=30/1 | nvvidconv | ‘video/x-raw(memory:NVMM),format=NV12’ | nvoverlaysink
bash: video/x-raw: No such file or directory
bash: video/x-raw(memory:NVMM),format=NV12: No such file or directory
bash: nvvidconv: command not found
bash: nvoverlaysink: command not found
ERROR: pipeline could not be constructed: no element “v412src”.

oops! There was a mistake

~$ gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=848,height=480,framerate=30/1 ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12’ ! nvoverlaysink
WARNING: erroneous pipeline: no element “nvvidconv”

this is in my case.

For installing/running docker, please check

You need to install v4l-utils for executing v4l2-ctl comamnd.

$ sudo apt install v4l-utils

First, I checked for installing/running docker, but

my case is

~ sudo dpkg --get-selections | grep nvidia [sudo] password for : libnvidia-container-tools install libnvidia-container0:arm64 install nvidia-container-csv-cuda install nvidia-container-csv-cudnn install nvidia-container-csv-tensorrt install nvidia-container-csv-visionworks install nvidia-container-runtime install nvidia-container-toolkit install nvidia-docker2 install nvidia-l4t-3d-core install nvidia-l4t-apt-source install nvidia-l4t-bootloader install nvidia-l4t-camera install nvidia-l4t-ccp-t186ref install nvidia-l4t-configs install nvidia-l4t-core install nvidia-l4t-cuda install nvidia-l4t-firmware install nvidia-l4t-graphics-demos install nvidia-l4t-gstreamer install nvidia-l4t-init install nvidia-l4t-initrd install nvidia-l4t-jetson-io install nvidia-l4t-jetson-multimedia-api install nvidia-l4t-kernel install nvidia-l4t-kernel-dtbs install nvidia-l4t-kernel-headers install nvidia-l4t-multimedia install nvidia-l4t-multimedia-utils install nvidia-l4t-oem-config install nvidia-l4t-tools install nvidia-l4t-wayland install nvidia-l4t-weston install nvidia-l4t-x11 install nvidia-l4t-xusb-firmware install ~ sudo docker info | grep nvidia
Runtimes: nvidia runc

Second, v4l-utils were already installed. but,

~$ sudo v4l2-ctl -d /dev/video1 --list-formats-ext
failed to open /sys/dev/char/0:0/uevent


~$ sudo gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=848,height=480,framerate=30/1 ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12’ ! nvoverlaysink
WARNING: erroneous pipeline: no element “nvvidconv”

Is there no way??

how do you run the docker container?
could you share the exact script, please?

We have two docker packages for L4T(Jetson platforms):
FYR and you may give it a try.