Hello,
I am having trouble using the camera inside docker container.
My current setup is as follows:
- Nvidia Jetson Xavier NX with Jetpack 5.1 freshly installed,
- docker image: nvcr.io/nvidia/l4t-base:r35.2.1
- camera model: ArduCam IMX219
Running the camera on the host system without Docker works fine. Running the following command produces visible output from the sensor.
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1280, height=720, framerate=30/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=540' ! nvvidconv ! nvegltransform ! nveglglessink
Similar issue was described here but answer didn’t solve my problem: [link]
The problem occurs inside the docker container. I run docker with the following command:
sudo docker run -v /dev/video0:/dev/video0 --device=/dev/video0:/dev/video0 -v /lib/modules:/lib/modules --runtime nvidia --network host -it --cap-add SYS_PTRACE -v /tmp:/tmp nvcr.io/nvidia/l4t-base:r35.2.1
Then inside container I want to run camera with same command as on the host system + --gst-debug-level=2 flag. Command produces the following errors:
Setting pipeline to PAUSED ...
Using winsys: x11
Pipeline is live and does not need PREROLL ...
0:00:00.924015055 42 0xffff5c002270 WARN structure gststructure.c:1861:priv_gst_structure_append_to_gstring: No value transform to serialize field 'display' of type 'GstEGLDisplay'
Got context from element 'eglglessink0': gst.egl.EGLDisplay=context, display=(GstEGLDisplay)NULL;
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.932327476 42 0xaaaaf306db60 ERROR egladaption gstegladaptation.c:660:gst_egl_adaptation_choose_config:<eglglessink0> Could not find matching framebuffer config
0:00:00.932439893 42 0xaaaaf306db60 ERROR egladaption gstegladaptation.c:674:gst_egl_adaptation_choose_config:<eglglessink0> Couldn't choose an usable config
0:00:00.932492085 42 0xaaaaf306db60 ERROR nveglglessink gsteglglessink.c:2709:gst_eglglessink_configure_caps:<eglglessink0> Couldn't choose EGL config
0:00:00.932544309 42 0xaaaaf306db60 ERROR nveglglessink gsteglglessink.c:2767:gst_eglglessink_configure_caps:<eglglessink0> Configuring caps failed
0:00:00.932717334 42 0xaaaaf3530c00 ERROR nveglglessink gsteglglessink.c:2808:gst_eglglessink_setcaps:<eglglessink0> Failed to configure caps
0:00:00.932878007 42 0xaaaaf3530c00 ERROR nveglglessink gsteglglessink.c:2808:gst_eglglessink_setcaps:<eglglessink0> Failed to configure caps
0:00:00.932966039 42 0xaaaaf3530c00 WARN GST_PADS gstpad.c:4231:gst_pad_peer_query:<nvegltransform0:src> could not send sticky events
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3280 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 3280 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 4
Output Stream W = 1280 H = 720
seconds to Run = 0
Frame Rate = 59.999999
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
0:00:01.379325424 42 0xaaaaf3530c00 ERROR nveglglessink gsteglglessink.c:2808:gst_eglglessink_setcaps:<eglglessink0> Failed to configure caps
0:00:01.392769900 42 0xaaaaf3530c00 ERROR nvegltransform gstnvegltransform.c:419:gst_nvegl_transform_transform:<nvegltransform0> Something is wrong, EGLImage is expected.
0:00:01.392946828 42 0xaaaaf3530c00 WARN basesrc gstbasesrc.c:3072:gst_base_src_loop:<nvarguscamerasrc0> error: Internal data stream error.
0:00:01.393063373 42 0xaaaaf3530c00 WARN basesrc gstbasesrc.c:3072:gst_base_src_loop:<nvarguscamerasrc0> error: streaming stopped, reason error (-5)
0:00:01.393471183 42 0xaaaaf3530c00 ERROR nveglglessink gsteglglessink.c:2808:gst_eglglessink_setcaps:<eglglessink0> Failed to configure caps
0:00:01.393582319 42 0xaaaaf3530c00 ERROR nveglglessink gsteglglessink.c:2808:gst_eglglessink_setcaps:<eglglessink0> Failed to configure caps
0:00:01.393681008 42 0xaaaaf3530c00 ERROR nveglglessink gsteglglessink.c:2808:gst_eglglessink_setcaps:<eglglessink0> Failed to configure caps
ERROR: from element /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0:
streaming stopped, reason error (-5)
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Interrupt while waiting for EOS - stopping pipeline...
Execution ended after 0:00:18.447234724
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
0:00:19.584135213 42 0xaaaaf3531180 ERROR nvarguscamerasrc gstnvarguscamerasrc.cpp:1673:consumer_thread:<nvarguscamerasrc0> Error in pool acquire buffer
Freeing pipeline ...
Without passing this volume from host system -v /lib/modules:/lib/modules
I get an additional error → modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.10.104-tegra
If I pass DISPLAY env variable to the container ( -e DISPLAY=$DISPLAY
) it gives following errors →
No EGL Display
nvbufsurftransform: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
No EGL Display
nvbufsurftransform: Could not get EGL display connection
Setting pipeline to PAUSED ...
Using winsys: x11
0:00:03.133211653 21 0xaaaaf3f78e40 ERROR egladaption gstegladaptation_egl.c:155:gst_egl_adaptation_init_display:<eglglessink0> Could not get EGL display connection
0:00:03.133304742 21 0xaaaaf3f78e40 ERROR egladaption gstegladaptation_egl.c:196:gst_egl_adaptation_init_display:<eglglessink0> Couldn't setup window/surface from handle
0:00:03.133353222 21 0xaaaaf3f78e40 ERROR nveglglessink gsteglglessink.c:564:egl_init:<eglglessink0> Couldn't init EGL display
0:00:03.133431879 21 0xaaaaf3f78e40 ERROR nveglglessink gsteglglessink.c:590:egl_init:<eglglessink0> Failed to perform EGL init
ERROR: Pipeline doesn't want to pause.
Setting pipeline to NULL ...
Freeing pipeline ...
Additional information:
camera is seen in /dev folder:
root@ubuntu:/# ls -l /dev/video0
crw-rw----+ 1 root video 81, 0 Mar 31 06:10 /dev/video0
root@ubuntu:/# v4l2-ctl --list-devices
vi-output, imx219 9-0010 (platform:tegra-capture-vi:0):
/dev/video0
- How can I get the camera working inside the container l4t based container? What is missing inside the container if the same command works on the host system?
- Furthermore I would like to make the camera work inside non-l4t based container. I need to use ubuntu 22.04 docker image with ROS2. Any suggestions for the ros2 driver that can work with mipi camera? I tried ros2_v4l2_camera without success and moved to trying make camera work inside l4t based container.