What better way to say 'Happy Pi Day' than by installing Docker Engine - Community (CE) 18.09 on Raspberry Pi. This article will walk you through the process of installing Docker Engine 18.09 on a Raspberry Pi. There are many articles out there that show this process, but many failed due to older Engine versions. This post describes how to setup you raspberry from scratch for running, monitoring and deploying docker container, monitoring the raspberry system and accessing the gpio pins. This all will be done without any manual setup on the raspberry so its 100% repeatable. You will be able to: deploy docker container via a web gui (www.portainer.io) Continue reading 'Docker on Raspberry with GUI'.
- Step 6: Multi Arch Images. As mentioned before, RPi is not a keen on processing power. Use RPi build Docker image may not a good choice, especially when your only RPi is running another projects. Use an x86 computer also can help you build the Docker Image, please find more details here.
- An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi. Docker today support the latest Raspbian Buster release.
I’m currently working on a fun side project involving 5 Raspberry Pis and an arduino (a stupidly long post about that coming in the future, fear not) and I’ve run into an issue on both my Raspberry Pi 2 and my Raspberry Pi Zero W when trying to get docker working.
What’s the problem?
Well, I am no expert on these things, but essentially the Pi 2 and the Zero run an older processor, ARM6 types to be precise. The issue when you try to install docker using their excellent one liner, it barfs right at the end with a failure…. this seems to be caused by one of the packages that docker requires (containerd.io) not liking these older arm processors… but it used to run fine.
What’s the solution?
Pretty simple.. use an older version of containerd.
How do I do that?
Glad you asked. Pretty simple. (Assuming you have your pi setup correctly with buster, and all the packages up to date)
To start, run the basic docker install script
This will spit out an error at the end. Fear not.
Huge shout out to github user michalng for the solution he helped me out with here.
Basically, you need to go back, overwrite the containerd install with an updated (yet older) version. (I’ve added in the sudos as that’s the way I need to run this on my fairly vanilla pi install)
And one last step… don’t forget to add your current user (in my instance “pi”) into the docker group, so you don’t’ need to sudo everything
Now, restart your pi so all these changes can take effect
… and once it boots back up, you should be able to run docker normally, try it out with
One final note here…. I usually test docker with hello-world
For whatever reason, this image doesn’t work on ARM6 pis.. I haven’t dug into it much, as the image I needed worked fine. But be aware if you try to run that and it barfs (or as in my case, just exits with no output) don’t worry, other images should work fine.
Docker? Docker is a software platform that levels the playing field. It creates an autonomous environment for running applications that is completely removed from hardware, operating system, and other software. It removes the guesswork from installing and running applications, because it removes all the variables from the environment. Once you have created your docker environment, you can run anything that’s been containerized for docker. Caveat emptor: we’re doing this on Raspberries so we’ll have to look a little deeper to find containers that have been created on the armhf architecture if we want them to run. So, let’s get docker installed on a couple of Raspberries and then create a little cluster to get them to share resources and create everyone’s favorite platform.
Basic Docker Install
On each of the Raspberries that you’d like to be your docker cluster run the following. We’re going to download a script from docker.com and run it to do an automated install.
Add the pi user to the docker group. This gives pi all the rights and privileges required to run docker without having to rely on the root user.
AND you’re done. Good job. End of post. Yeah, but you were hoping for a little more. Reboot and login as pi, then try to use this command to download and run an Ubuntu container. If all goes well, you’ll get an Ubuntu shell prompt.
YAY! It works. Now, let’s set docker to load at start up:
Create the swarm
OK! We’ve got docker running on our Pis! Next, we need to put them in contact with each other so they can share resources and spread the load. The mechanism to do this is called “swarm”. Basically, what we’re doing is creating a cluster of raspberries. The process is to install swarm on the main node, the manager, and then join the other raspberries running docker to the manager. You’ll need the IP address of your manager for this command. I’m calling my manager docker0. Its address is 192.168.1.20.
The command initializes the swarm, sets up the node as manager, and then spits out the command to run on the rest of the nodes. I’ll just cut&paste that command into the other nodes’ terminals. Then I can check my work with the command:
Skimming through the info presented, I find:
Run Raspberry Pi In Docker
… which is what I was expecting. Another way to confirm this is to run:
Install a Container
Let’s run a container! Keep in mind that we need to look for containers that have been created to run on ARM architecture! I knew about viz and was happy to find that someone had ported it to armhf. Since we’re already trying to visualize our new swarm, let’s run an image provided by @alexellisuk. Cut and paste this into your manager node:
Docker In Raspberry Pi
This command will download, configure, and run your first container. The publish line is the argument that tells docker what port to expose to the network. Fire up your browser, surf to the IP address of your manager:8080:
Docker In Raspberry Pi 4
We can see a graphical representation of our swarm! We see the “viz” container in the running state. AND, good news, I finally found my 8GB raspberry! It’s running as docker2!