'nvcamerasrc' in docker container gives 'Connecting to camera_daemon failed'

The docker container was created with the --privileged flag and has the /dev, /proc and /sys folders mounted from the host TX2 board, so the docker container has the ‘nvhost…’ devices such as ‘nvhost-gpu’.

However when I run the GStreamer pipeline which uses the ‘nvcamerasrc’ element I get ‘Connecting to camera_daemon failed’. Error message:
ERROR nvcamerasrc gstnvcamerasrc.cpp:2411:gst_nvcamera_socket_connect:<camera_src> Connecting to camera_daemon failed

I manually copied the actual ‘nvcamera-daemon’ and ‘nvcamera-daemon.service’ files from usr/sbin and etc/systemd/system on the host to the same places in the container but this has not made a difference.

So I’m just trying to use the nvcamera-daemon service (the nvcamerasrc requires this) from a docker container on the TX2 board rather than directly on the board. Has anyone had success with Tegra-docker GitHub - Technica-Corporation/Tegra-Docker: Instructions and key files to enable Docker support on NVIDIA Tegra devices, specifically the TX-2. or another method of doing this, perhaps that doesn’t require Cuda?

Thanks
Milan

Hi,
Not sure but maybe it fails to create /tmp/nvcamera_socket in docker mode?

Hi DaneLLL,

You are right that it doesn’t create the /tmp/nvcamera_socket in the docker container. However, when I try and copy nvcamera_socket from /tmp on the host to the container I get

‘ERRO[0000] Can’t add file /tmp/nvcamera_socket to tar: archive/tar: sockets not supported’

Do you know what I can do about this and how I can get the socket to be created in the container?

Thanks
Milan

Copying the systemd files into the image will most likely not work the way you expect, since you probably don’t have systemd in the container, so the daemon will not be started.

We just let nvcamera-daemon run on the host outside the container, and then mount /tmp/nvcamera_socket into the container using a volume mount like this:

-v /tmp/nvcamera_socket:/tmp/nvcamera_socket

This way you don’t have to copy anything extra inside the container, and if you have multiple containers accessing the cameras you will still only have one instance of the daemon running on the host.