I use the below command to mount my the argus_socket into my docker container.
docker run -dit --gpus all --privileged -v /tmp/.X11-unix/:/tmp/.X11-unix/ -e DISPLAY=$DISPLAY -v /tmp/argus_socket:/tmp/argus_socket --network=host --name=myimage myimage bash
But I realized that, if on the host system, I run
sudo service nvargus-daemon restart
Then in the container, the /tmp/argus_socket file won’t be refreshed (I observed the file creation time). Also if I try to use argus SDK, it will direct raise the below error
(Argus) Error FileOperationFailed: Connecting to nvargus-daemon failed: Connection refused (in src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 205)
(Argus) Error FileOperationFailed: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 106)
I have to restart the docker container to refresh the argus_socket file. Is there any better ways to do that? i don’t know why this mounted device fd can’t be auto refreshed.
Also a follow-up question, the reason that I want to do sudo service nvargus-daemon restart is mainly that if I exit my application which is calling argus in properly (for example using ctrl+c or it’s just crashed due to some issue), it will leave the argus-daemon malfunction and if I rerun my application, it will be stuck at reading camera info. Then I have to restart the daemon to make it work.
when running in normal env without docker, it’s not a problem. In normal env, if app crashed or something, i can directly rerun. However, sometimes crash can cause the nvargus daemon hanging and I have to run sudo service nvargus-daemon restart. But after running this restart cmd, the /tmp/argus_socket will be updated and I can directly run the my app.
Restarting nvargus-daemon will delete the existing socket file and create a new socket file.
The i-node of the socket file will also be new.
The docker mount is managed by i-node.
New i-node is not mounted and therefore not available.
How about mounting the /tmp directory instead?
before:
docker run -dit --gpus all --privileged -v /tmp/.X11-unix/:/tmp/.X11-unix/ -e DISPLAY=$DISPLAY -v /tmp/argus_socket:/tmp/argus_socket --network=host --name=myimage myimage bash
after:
docker run -dit --gpus all --privileged -e DISPLAY=$DISPLAY -v /tmp/:/tmp/ --network=host --name=myimage myimage bash
The crash i mentioned, i mean our app crash. Basically our app crash and then it didn’t clean up argus resources. Then if I just restart my app, the argus daemon will hang. I have to restart the argus daemon manually.