如何使用gstreamer在docker容器内运行服务以从IDS uEye摄像机获取提要? [英] How can I run a service inside a docker container to get feed from a IDS uEye camera using gstreamer?

查看:297
本文介绍了如何使用gstreamer在docker容器内运行服务以从IDS uEye摄像机获取提要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用gstreamer插件捕获摄像头输入的docker容器.使用Bastler相机可以正常运行,但是现在我需要使用IDS uEye相机.为了能够使用此相机,我需要运行ueyeusbdrc服务. IDS文档说,要启动它,我可以运行sudo systemctl start ueyeusbdrcsudo /etc/init.d/ueyeusbdrc start.问题是,当docker容器运行时,该服务未运行,并且出现无法初始化摄像头错误,这与在运行gst-launch-1.0 -v idsueyesrc ! videoconvert ! autovideosink且ueyeusbdrc服务为没有在我PC的容器外部运行.因此,这告诉我问题是ueyeusbdrc服务未在容器内运行.

I have a docker container that uses a gstreamer plugin to capture the input of a camera. It runs fine with a Bastler camera but now I need to use an IDS uEye camera. To be able to use this camera I need to have the ueyeusbdrc service running. The IDS documentation says that to start it I can run sudo systemctl start ueyeusbdrc or sudo /etc/init.d/ueyeusbdrc start. The problem is that when the docker container runs, that service is not running and I get a Failed to initialize camera error, which is the same error I get if I run gst-launch-1.0 -v idsueyesrc ! videoconvert ! autovideosink and the ueyeusbdrc service is not running outside the container in my PC. So this tells me that the issue is that the ueyeusbdrc service is not running inside the container.

如何在docker容器中运行ueyeusbdrc?我试图在启动应用程序的.sh脚本中运行/etc/init.d/ueyeusbdrc start(在Dockerfile中使用ENTRYPOINT ["<.sh file>"]进行调用),但是失败.另外,如果我尝试使用sudo,它会告诉我该命令不存在.如果我运行systemctl,它还会告诉我该命令不存在.顺便说一句,我正在用privileged: true运行docker(至少那是在docker-compose.yml文件中设置的).

How can I run the ueyeusbdrc inside the docker container? I tried to run /etc/init.d/ueyeusbdrc start in the .sh script that launches the application (which is called using ENTRYPOINT ["<.sh file>"] in the Dockerfile), but it fails. Also if I try to use sudo, it tells me that the command doesn't exist. If I run systemctl it also tells me the command doesn't exist. BTW, I am running the docker with privileged: true (at least that's what is set in the docker-compose.yml file).

我正在使用Ubuntu 18.04.

I am using Ubuntu 18.04.

更新: 我将/run/ueyed和/var/run/ueyed映射到容器,并将错误从无法初始化相机更改为无法初始化视频捕获.可能是我可以在主机中运行守护程序,并且有一种方法可以将其挂接到容器.有关如何执行此操作的任何建议?

Update: I mapped /run/ueyed and /var/run/ueyed to the container and that changed the error from Failed to initialize camera to Failed to initialize video capture. It may be that I can run the daemon in the host and there is a way to hook it to the container. Any suggestions on how to do that?

推荐答案

终于解决了这个问题.我必须在docker命令中添加一些选项(在本例中,是在docker-compose yml文件中).我的解决方案基于此处的设置: https://github.com/chalmers-revere/opendlv-device-camera-ueye

Finally got this working. I had to add a few options to the docker command (in my case to the docker-compose yml file). I based my solution on the settings found here: https://github.com/chalmers-revere/opendlv-device-camera-ueye

将这些参数添加到docker命令可解决问题:--ipc=host --pid=host -v /var/run:/var/run.使用这些选项,无需在容器内运行服务.

Adding these arguments to the docker command solved the issue: --ipc=host --pid=host -v /var/run:/var/run. With these options there is no need to run the service inside the container.

另一个关键部分是在Docker容器中安装IDS软件.可以通过下载,解压缩并运行安装程序来轻松完成此操作(上面提到的git repo具有过时的版本,但是最新版本可以在IDS网页上找到).

The other key part is to install the IDS software inside the docker container. This can be easily done by downloading, extracting and running the installer (the git repo mentioned above has an outdated version, but the most recent version can be found in the IDS web page).

还要确保IDS uEye摄像机的系统服务正在主机(sudo systemctl start ueyeusbdrc)中运行.

Also, make sure the system service for the IDS uEye camera is running in the host (sudo systemctl start ueyeusbdrc).

这篇关于如何使用gstreamer在docker容器内运行服务以从IDS uEye摄像机获取提要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆