1.8 Quickstart 37
# start with slim version of actual Debian
FROM debian:9-slim
ENV LC_ALL C
ENV DEBIAN_FRONTEND noninteractive
# entrypoint of Docker
CMD ["/bin/bash"]
# set environment variables
ENV TERM linux
ENV MVIMPACT_ACQUIRE_DIR /opt/mvIMPACT_Acquire
ENV MVIMPACT_ACQUIRE_DATA_DIR /opt/mvIMPACT_Acquire/data
ENV container docker
# update packets and install minimal requirements
# after installation it will clean apt packet cache
RUN apt-get update && apt-get -y install build-essential && \
apt-get clean && \
rm -rf /var/lib/apt/lists/
*
/tmp/
*
/var/tmp/
*
# move the directory mvIMPACT_Acquire with
*
.tgz and
*
.sh files to the container
COPY mvIMPACT_Acquire /var/lib/mvIMPACT_Acquire
# execute the setup script in an unattended mode
RUN cd /var/lib/mvIMPACT_Acquire && \
./install_mvBlueFOX.sh -u && \
rm -rf /var/lib/apt/lists/
*
/tmp/
*
/var/tmp/
*
At last, build a Docker image using this Dockerfile:
$ sudo docker build -t [image_name] .
Note
Please make sure to call docker build from within the directory where the Dockerfile resides. An Internet
access is required for the docker build.
If built successfully, the newly built [image_name] will be listed when calling:
$ sudo docker images
1.8.8.3 Starting The Docker Container
Since the Docker container is isolated from the host system, it needs to be started with volume mount of /dev
and certain cgroup permissions for it to access mvBlueFOX cameras. In order to avoid running the container in
privileged mode, which is not secure, it can be started like this:
$ sudo docker run -ti -v /dev:/dev --device-cgroup-rule ’a 189:
*
rwm’ [image_name] /bin/bash
Where:
• -v /dev:/dev: use volume mount to map the host /dev directory to the container, so the container will be able
to always detect devices also when they get unplugged and re-plugged at any time.
• –device-cgroup-rule 'a 189:
∗
rwm': with the –device-cgroup-rule flag, specific permission rules can be
added to a device list that is allowed by the container's cgroup. Here in this example, 189 is the major number
of the USB bus,
∗
means all minor numbers, and rwm are respectively read, write, mknod accesses. By doing
so, all USB devices will get read, write, mknod access. The mvBlueFOX camera can thus be enumerated
successfully.
MATRIX VISION GmbH