初始化raw1394在docker中持续存在打开CV错误 [英] Open CV error failed to init raw1394 persisting in docker

查看:588
本文介绍了初始化raw1394在docker中持续存在打开CV错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Docker容器中运行ubuntu 14.04,并安装了opencv。每次运行时,我会收到如下所述的以下错误: OpenCV:libdc1394错误:无法初始化libdc1394 。将/ dev / null链接到设备文件的技术似乎起作用,但是在docker容器中并不持久,即使我有

I am running ubuntu 14.04 in a docker container and have opencv installed. Every time it runs I recieve the following error as described here: OpenCV: libdc1394 error: Failed to initialize libdc1394. The technique of linking /dev/null to the device file seems to work, but it is not persistent in the docker container, and even though I have

RUN ln /dev/null /dev/raw1394

运行类似

docker-compose run <container> bash

错误将持续在该会话中。什么行可以添加到我的docker文件,将摆脱这个错误消息?

the error will persist in that session. What line can I add to my docker file that will get rid of this error message?

推荐答案

运行 Dockerfile中的ln / dev / null / dev / raw1394 将不会帮助您,因为 / dev 不是Docker映像的一部分。您可以添加 卷挂载 。一个例子 Dockerfile docker-compose.yml 将如下所示:

Running ln /dev/null /dev/raw1394 inside the Dockerfile won't help you because /dev is not part of the docker image. You can get around this by adding a volume mount. An example Dockerfile and docker-compose.yml would look like this:

[fedora@myhost ~]$ cat Dockerfile 
FROM ubuntu:14.04
RUN apt-get update && \
    apt-get install -y \
        libdc1394-22-dev \
        libdc1394-22 \
        libdc1394-utils \
        python-opencv && \
    rm -rf /var/lib/apt/lists/*

[fedora@myhost ~]$ cat docker-compose.yml 
version: '2'
services:
  opencv:
    build: .
    command: python -c "import cv2; print cv2.__version__"
    volumes:
      - /dev/null:/dev/raw1394

[fedora@myhost ~]$ sudo docker-compose up  
Recreating fedora_opencv_1
Attaching to fedora_opencv_1
opencv_1  | 2.4.8
fedora_opencv_1 exited with code 0

这篇关于初始化raw1394在docker中持续存在打开CV错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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