Reputation: 4078
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
in my docker file if I run something like
docker-compose run <container> bash
the error will persist in that session. What line can I add to my docker file that will get rid of this error message?
Upvotes: 2
Views: 919
Reputation: 16639
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
Upvotes: 3