This is a small example application called driving_control, which utilizes the rover-api to perform some basic driving maneuver. The steps described below are tested on Ubuntu 16.04.
Create a daemon.json file in /etc/docker/ and add
{
"experimental" : true
}
$ sudo systemctl restart docker
$ sudo apt-get install qemu-user-static
$ cd <your rover-example-app dir>
$ cp /usr/bin/qemu-arm-static ./qemu-arm-static
$ docker build --platform linux/arm32v6 -f ./driving_control_iotplayground/Dockerfile -t arm32v6/rover-app:0.0.1 .
First time:
$ cd <your rover-example-app dir>/driving_control
$ docker run --privileged -v $(pwd):/root/workspace/driving_control -w /root/workspace/driving_control -it arm32v6/rover-app:0.0.1 /bin/bash
Thereafter:
$ docker start -i <your image id>
If it does not work:
$ docker run --privileged -it arm32v6/rover-app:0.0.1 /bin/bash
In the container:
$ cd /root/workspace/driving_control/src
$ g++ -lroverapi -o driving_control driving_control.cpp
You can use the docker image that you built above as a base image to dockerize your application. The result won't be the smallest passible image but you will have the rover-api and all of its dependencies available. We created a minimal example of a corresponding dockerfile in the docker-example
directory. You can build the image with:
$ cd <your rover-example-app dir>
$ docker build --platform linux/arm32v6 -f ./docker-rover-example/Dockerfile -t arm32v6/rover-example:0.0.1 .
Alternatively consider just copying your binaries to a directory that is not mounted from the host system and create an image:
$ docker commit <your container id>
Make sure to start the containers inferred from the resulting image on raspbian as follows:
$ docker run --privileged -v /var/run/systemd:/var/run/systemd -v /dev/video0:/dev/video0 -v /lib/modules:/lib/modules <your image id>
The docker container already contains a lightweight IDE called geany. If you want to use it, allow all clients to access to the host's X-Server
$ xhost +
Start the container as follows:
$ cd <your rover-example-app dir>/driving_control
$ docker run -v $(pwd):/root/workspace/driving_control -w /root/workspace/driving_control -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix arm32v6/rover-app:0.0.1 geany