Experience with Docker on Raspberry Pi?


#1

Hey fellow farmers, are any of us Docker experts?

I’m investigating better ways to create images for the Raspberry Pi onboard the Food Computer. Ideally, I’d like to be able to script and automate the creation of the RPi’s environment. Docker is the cool way to do this now, right?

It appears that you can run Docker on the Raspberry Pi and the runtime cost is minimal. Does anybody have experience doing this? If so, what were the pros/cons?


#2

Nice! Hypriot created an apt package repo for Raspbian, so you can apt-get install docker-hypriot http://blog.hypriot.com/post/your-number-one-source-for-docker-on-arm/.


#3

Nothing related to this project at all, and I’m certainly not a Docker expert, but I’ve done things like run a PostgreSQL container in Docker on the Pi. I set it up a while back, and it was not completely seamless, but once it was installed it has been stable. Now I can comfortably take it for granted. Judging by your links, it seems like it’s even more straightforward to get it set up now.

If you’re looking for a hand, I’m definitely up for a real use case to try and build my Docker skills and learn about the food computer. I don’t presently have a food computer, but am hoping to head in that direction in the near future, so anything that would end up making it easier is in my interest.

Where do you see the advantage over provisioning with something more script based than container based? Is there an opportunity to run the code on something that’s not a Pi? Or run multiple instances on a single Pi (one of the more appealing aspects of Docker in my view).


#4

Provisioning the environment could be scripted with Bash or Python, but I see a few upsides to Docker:

  • Lighter than distributing a full image
  • It makes sure we have the right Linux environment
  • There are a bunch of Pi Docker images we could leverage (ROS, etc)

Also, if we wanted, we could run a minimal kernel with just Docker. I’ve been leaning away from this for now, since Raspbian is the happy path for the Pi, but it is nice to know it’s possible.

@toby would you be interested in working with me on this? I’m currently looking into creating a Docker image for the 1.1 software stack (still in-development). A 1.0 Docker image would probably be useful to the community as well.


#5

I’m definitely interested, I’m just starting to look at the complete build process and the software seems like an extremely accessible aspect to me.

I haven’t looked at all at what the Pi is actually doing in the build though, so I’m starting completely from scratch. Is there a document somewhere about the provisioning process? I’ve seen mention to just using an image, but if there’s more information available I’m up for jumping in.

EDIT: Is the OpenAg Brain everything that goes on the Pi?


#6

Trying it out with an old Raspberry Pi B (the first one), it seems Hypriot has really ironed everything out.

That worked for me as written, I also gave it a shot downloading the package and installing it locally. Looks like they’re a little behind the latest - 1.10.3, looks like the most recent is 1.11.1. Only thing that sucks is it needs ARM compatible images - not as readily available.


#7

@toby awesome! For the 1.1 software, we’re using ROS (Robot Operating System). I need to take a look at https://hub.docker.com/r/pablogn/rpi-ros-core-indigo/ to see if it will do the trick.

I had trouble getting the docker -i -t commands to work (so I could run commands within the container). Did this work for you?


#8

What containers were you trying to run? I haven’t looked at the ROS at all, so maybe there’s a compatibility problem there? I’ve run a couple different ones successfully, note that they have to be ARM compatible. I have the following all running as expected with Docker version 1.10.3 on a Pi B:

  • alpine-mini (I think I just pulled it as is)
  • resin/rpi-raspbian
  • container based off of hypriot/rpi-alpine-scratch

The command I’ve used for double checking that I’m not lying is docker run -it --rm <image name>


#9

Granted I have no idea what you’re doing with it, but pulling the rpi-ros-core-indigo image worked fine for me:

pi@raspberrypi:~ $ docker run -it --rm pablogn/rpi-ros-core-indigo

pi@b6caf4546db3:~$ uname -a
Linux b6caf4546db3 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux

pi@b6caf4546db3:~$ lsb_release -irc
Distributor ID: Raspbian
Release:        8.0
Codename:       jessie

pi@b6caf4546db3:~$ printenv | grep ROS
ROS_ROOT=/opt/ros/indigo/share/ros
ROS_PACKAGE_PATH=/opt/ros/indigo/share:/opt/ros/indigo/stacks
ROS_MASTER_URI=http://localhost:11311
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=indigo
ROS_ETC_DIR=/opt/ros/indigo/etc/ros

#10

Hi, just started to look at the software side of the Food Computer and caught up with this thread. I first heard of Docker when I was experimenting with Ubuntu Core for the Raspberry Pi 2. They call it Snappy Ubuntu, https://developer.ubuntu.com/en/snappy/start/using-snappy/ , the link gives an overview of how it works and how you can build your own apps using Snapcraft, https://developer.ubuntu.com/en/snappy/build-apps/,

I think the advantage is that the program dependencies are all included in the .snap package file so that the end user has less of a problem getting things to work together. I think that Docker is used as what you might call an, App manager. I don’t have any practical experience of building anything with Snapcraft as I got stuck trying to cross-compile packages for the Raspberry Pi.
Found this link, https://kyrofa.com/posts/building-your-snap-on-device-there-s-a-better-way, It appears that you can use the Launchpad team snap builder servers, to build for different architectures in a clean environment.
There is a company called, Erle Robotics, http://erlerobotics.com/docs/Intro.html, they are one of the examples on the Ubuntu site, they just use ROS and ROS 2 to control things from a Raspberry Pi no added Arduino. There experiences might be relevent ?
Not sure this is of any use to you or whether or not it is the same as using Docker and Hypriotos.

Update, just been playing with Snappy Ubuntu on the Raspberry Pi, there is a already a Docker snap package you can install. The Pi needs to be running Ubuntu Core. Hmmm what OS are we running on the Pi ? Is it Raspbian Jessie ?


#11

I believe @DougieFresh is also trying to build a Dockerfile for the 1.1 software. @DougieFresh how far along are you? Is this on GH?


#12

Yesterday I was able to install and run the openag_brain code on a fresh Raspbian installation by installing Docker and Docker-compose, cloning the github project, and running docker-compose up from the root of the project. So it’s basically done.


#13

@DougieFresh - is that pushed here: https://github.com/OpenAgInitiative/openag_brain? Looking at the various available branches, I don’t see a docker compose yaml file. I’d love to check it out.


#14

Yes, I’ve been working in the ros branch of that repo. I recently took out the docker compose file because it doesn’t actually make sense to include it in that repo. I plan to push an image to Docker Hub and then make another repo with the docker-compose file and and an installation script. Anyway, I think this is the commit that I got working with docker compose.


#15

This is also an interesting deployment project to get inspired by: https://resin.io/how-it-works/

It is meant to be used for a company that owned a lot of devices on their fleet, but the cool thing is that it is free up to 5 RPi


#16

I guess I didn’t look hard enough, I couldn’t find a docker image for CouchDB on the Pi so I ended up trying to build one myself. Ended up with something quite a bit worse than the dogi/rpi-couchdb image you built from, as I’ve never used CouchDB before… Is that something you made yourself or just happened upon?

For playing around, it’s always nice to containerize these things.


#17

I actually spent some time trying to build my own couchdb image too before I found dogi/rpi-couchdb. Getting to reuse that was actually a huge win.


#18

Is the Docker implementation the same image as the Raspberry Pi image that is floating around somewhere (link if you know where it is?)? Or is the Docker version the “next generation”?


#19

The Docker image is the “next generation” which is still under development. This link describes the initial software release and includes a link to the Pi image you were talking about.


Toby's Build Diary
#20

I saw https://github.com/OpenAgInitiative/openag_brain_docker_rpi showed up - how’s this going? Where does it fit in with the first generation food computer? Will the two generations be entirely incompatible? Has anyone done a docker version of the first generation image? What’s the best way to follow along with the software development for the newer generation - is it a group effort, or are you driving it yourself?

I’m trying to make sense of the software side of the puzzle, and the version 1 vs version 1.1 vs version 2 aspect is a bit super confusing for the start. If there’s anything I can help with (even just documentation at this point, while I’m trying to grasp what’s going on), give me a shout!