Skip to content

Docker on Raspberry Pi

Charlie Martin edited this page Jun 19, 2017 · 23 revisions

Note: the Raspberry Pi Docker now includes influxdb and grafana yet.

ToDo

  • NTP:
    • Hypriotos seems to be running the ntp service, but the clock is not getting set. This fouls up the dashboard. (N.B. This turned out to be due to the NCAR network not allowing NTP messages to come into the network. In this case, set the time manually.)
    • We are including ntp in the chords_app image, but it doesn't seem to be doing anything either, and we can probably remove it. That is assuming that the container gets it's time form the host.
  • Nginx: Need to get this running

Hypriot

Hypriot is focused on making container technology viable on Arm and IoT devices. They have a Raspberry Pi (RPi) operating system hypriotos image with an Arm version of Docker running. Their flash tool makes it trivial to bring up a Raspberry Pi that is running Docker.

Flashing the Boot Card

A complete Docker ready RPi O/S image is available from Hypriot. Follow these Instructions to flash the Rpi microSD card. It's very simple.

  • Hint: Change the host name from black-pearl.local to chords.local by specifying -n chords to the flash command. Alternatively, log in and edit /boot/device-init.yaml to change the host name.
  • Hint: The lore is that there is a big performance payback if you use a high performance microSD card. In addition, it should be at least 16GB. An 8GB card will work, but there is not a lot of spare space.

Boot Up and Login

Power up the RPi system and login:

# If chords.local is not found, you will have to discover the IP 
# address that has been assigned by DNS, and use that instead.
ssh pirate@chords-pi.local # password: hypriot

Set the system time (UTC), which is necessary for the repository pulls to pass authentication:

sudo date -s 20160920T2021

Install and Run CHORDS

An RPi Docker image ncareol/rpi-chords is on Docker Hub. Just follow the standard CHORDS Docker instructions to install and run on the RPi.

Building the CHORDS image for Raspberry Pi

The Docker image can be built on the RPi. Due to QEMU capability in Docker for OSX, it can also be built on OSX. It's quicker to build and upload on OSX than on the RPi.

There are two configuration files which are specific to the CHORDS RPi image. rpi-Dockerfile defines the CHORDS Docker image. rpi-docker-compose.yml is the recipe for building and running the CHORDS containers.

git clone https://github.com/NCAR/chords_portal.git
cd chords_portal
git co docker
docker-compose -f rpi-docker-compose.yml build
docker push ncareol/rpi-chords

WiFi

  • Wifi access can also be enabled by specifying the network name and password on the flash command line, or by editing /boot/device-init.yaml. Hypriotos will magically connect to the wireless network. No fooling around with wlan setup is needed.
  • However, it seems that if you plug into an ethernet, and the specified WiFi network is not avaiable, it does not fall back to the ethernet. Just unplug the WiFi dongle in order to restore ethernet access.

Enabling Autostart

Tips

  • If you get a complaint about the certificate when pulling docker images, it's probably because the system time is wrong. date -s 20190919T18:43:21.
  • System time is sort of a bugaboo on the RPi. Ntp is configured and running Hypriotos, but for various reasons it may not be setting the clock. This is typically caused by situations where the ntp packets cannot get back to the RPi, due to firewall settings. Using ntpq and ntpdate-debian can help diagnose the problem. It can't hurt to add a known accessible server to /etc/ntp.conf.
ntpq -p
systemctl status ntp
systemctl stop ntp
ntpdate-debian time.nist.gov
systemctl start ntp
ntpq -p
Clone this wiki locally