The mini-computer Raspberry Pi is good for more than just playing around or teaching children about hardware and pro­gram­ming. Users have set up web servers on Raspberry Pi, as well as cloud servers using ownCloud. It’s even possible to combine Raspberry Pi and Nextcloud, and some users have built Raspberry Pi mail servers.

De­velopers have also made the single-board computer their own. Web and software de­velopers have already been using the mini-computer for a while, for example, in order to work with the Internet of Things. It seems high-time then to explore the ad­vant­ages of Docker on Raspberry Pi.

How to install Docker on Raspberry Pi

In the best case scenario, Docker can be installed with Raspberry Pi’s operating system. The Docker team has provided a special in­stall­a­tion script for this. The first step involves down­load­ing and executing the script, which you can do using a cURL command.

curl -fsSL https://get.docker.com | sh

To make sure that the in­stall­a­tion was suc­cess­ful, you can try out the 'hello world' image.

docker run armhf/hello-world

If everything is in order, Docker should pull the image from the Internet and execute it. You should get a message from the developer. The image here isn’t the normal 'Hello world' image that would run on other systems, but rather an image that was specially made for ARM pro­cessors.

Note

Docker con­tain­ers are made available by official de­velopers as well as members of the community. To minimise security risks, you should only use con­tain­ers that are actively main­tained and already being used by a good number of users. In the DockerHub you can also find con­tain­ers that were put together just for Raspberry Pi. The re­pos­it­ory also offers the option of only viewing 'official images' or con­tain­ers from 'verified pub­lish­er­s'.

Hypriot OS: the all-in-one solution

A small team of de­velopers produced a special operating system for people who want to have a better ex­per­i­ence with Docker and Raspberry Pi: Hypriot OS is specially pre-con­figured for using con­tain­ers. The operating system is based on Debian, but is kept to a minimum making it perfectly suited to both Raspberry Pi and Docker. The Kernel is also spe­cific­ally optimized for this purpose. Thanks to the light­weight structure of the system, it’s also possible to run several computers in parallel on re­l­at­ively in­ef­fi­cient systems.

Hypriot OS is installed like other operating systems for Raspberry Pi: First prepare an SD card on another computer with the image of Hypriot. (The operating system can be down­loaded for free from the official website or from GitHub.) Then insert the memory card into the Raspberry Pi. When it starts, the computer will then load from the card and run with Hypriot. Using an SSH con­nec­tion, you can then access the Raspberry Pi from the other computer and use Docker on Raspberry Pi.

Tip

Re­gard­less of how you bring together Docker and Raspberry Pi, you’ll also have to know how to work with the container software. Learn about the first steps and pick up a lot of important in­form­a­tion about Docker in our Docker tutorial.

Go to Main Menu