Thursday, February 8, 2018

RPi-Monitor Docker Container

Michael Miklis did create a Docker image for RPi-Monitor. 
Let's have a look to the capabilities of this image and how to use this container.

Docker in few words     Source: Wikipedia

Docker is a tool that can package an application and its dependencies in a virtual container that can run on any Linux server. This helps enable flexibility and portability on where the application can run, whether on premises, public cloud, private cloud, bare metal, etc.

Docker technology is providing operating-system-level virtualization also known as containers. [...] Docker uses the resource isolation features of the Linux kernel [...] to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines (VMs).

RPi-Monitor running in Docker container

As specified in Wikipedia's description, the goal of Docker is to isolate programs in containers. It has the advantage to keep the host system clean since programs and dependencies are installed inside a container but this advantage could become
a problem if your goal is to perform monitoring of host.

The solution provided by Michael is to share the part of host system with RPi-Monitor's container to allow access to KPI.

All volumes are mapped as read-only to ensure the container can't modify the data on the docker host. Additionally access to the Raspberry Pi's vchiq and vcsm device needs to be mapped to the container to access hardware sensors, like CPU Temperature, e.g.

The following command does the job:
docker run --device=/dev/vchiq \
--device=/dev/vcsm \
--volume=/opt/vc:/opt/vc \
--volume=/boot:/boot \
--volume=/sys:/dockerhost/sys:ro \
--volume=/etc:/dockerhost/etc:ro \
--volume=/proc:/dockerhost/proc:ro \
--volume=/usr/lib:/dockerhost/usr/lib:ro \
-p=8888:8888 \
--name="rpi-monitor" \
-d \
All the detail are gathered in the README and DockerHub pages of the Docker-RPi-Minitor project.

Note: This docker image is based on resin/rpi-raspbian:latest image and is then designed to run on ARM based architecture such as Raspberry Pi.

No comments :

Post a Comment