Can't communicate with camera in Docker

I’m trying to use camera in Docker container on my Jetson Nanpo. Without Docker container everything looks ok:

  1. I can take pictures
  2. gst-launch-1.0 nvarguscamerasrc ! fakesink gives me normal output:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 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: 3264 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: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; 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  = 2 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:01.857209030
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...

However if I try to communicate with camera in docker, I have this message for gst-launch-1.0 nvarguscamerasrc ! fakesink:

nvbuf_utils: Could not get EGL display connection
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
(Argus) Error NotSupported: Failed to initialize EGLDisplay (in src/eglutils/EGLUtils.cpp, function getDefaultDisplay(), line 77)
(Argus) Error BadParameter:  (propagating from src/eglstream/FrameConsumerImpl.cpp, function initialize(), line 89)
(Argus) Error BadParameter:  (propagating from src/eglstream/FrameConsumerImpl.cpp, function create(), line 44)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadInitialize:320 Failed to create FrameConsumer
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:241 (propagating)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, waitRunning:203 Invalid thread state 3
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:798 (propagating)
Redistribute latency...
Got EOS from element "pipeline0".
Execution ended after 0:00:00.221654446
Setting pipeline to NULL ...
Freeing pipeline ...

How can I fix this?
My docker container configuration:

  1. Base image is nvcr.io/nvidia/l4t-base:r36.2.0
  2. Running config is:
    --privileged -v /dev/shm:/dev/shm -v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket -v /tmp/argus_socket:/tmp/argus_socket -v /data:/data --network=host --runtime nvidia -v /tmp/.X11-unix/:/tmp/.X11-unix -v /dev/:/dev/
  3. Before running gst-launch-1.0 nvarguscamerasrc ! fakesink I always export env variable: export LD_PRELOAD=${LD_PRELOAD}:/usr/lib/aarch64-linux-gnu/libGLdispatch.so

Hello @lelikk2002,

You might find this interesting:

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_troubleshooting.html#deepstream-plugins-failing-to-load-without-display-variable-set-when-launching-ds-dockers

Please let us know if that helps.

regards,
Andrew
support@proventusnova.com

But I don’t have display, that’s why I don’t export DISPLAY variable

If I do what was listed in your link, I get this:

duckie@duckie06:~$ export DISPLAY=:0
duckie@duckie06:~$ xhost +
No protocol specified
xhost:  unable to open display ":0"

And I don’t use deepstream

@lelikk2002,

Thanks for getting back with more details.

Got it, yeah.

Can you try adding -e DISPLAY=$DISPLAY to your Docker run flags ?

regards,
Andrew
support@proventusnova.com

I’ve added nothing changed. The reason is that I don’t have DISPLAY variable in my shell, setting it to 0 as it was written in guide you’ve sent also didn’t bring any new results

@lelikk2002,

Thanks for running the test.

That is weird.
We do understand that you don’t have a display connected, we have a similar setup for one of our customers.
However, we are able to capture with nvarguscamerasrc.

But checking your flags, its seems like you are using the same as ours.

We will try to do more research over here.

regards,
Andrew
support@proventusnova.com