Docker on Raspberry Pi
Running docker on the raspberry pi is a fun process. Before I begin i should thank the Hypriot blog for making it possible and providing a great set of tutorials and guides. I own 2 Raspberry Pi’s (2 & 3) both running debian 8.0 jessie.
The instructions required to install docker on the RPi are pretty straight forward.
sudo apt-get install -y apt-transport-https
wget -q https://packagecloud.io/gpg.key -O - | sudo apt-key add -
echo 'deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ wheezy main' | sudo tee /etc/apt/sources.list.d/hypriot.list
sudo apt-get update
sudo apt-get install -y docker-hypriot
sudo systemctl enable docker
Do note that you need to be root to run docker commands so i suggest
sudo su
To switch to root. The first thing I recommend doing is installing the Docker-UI container built specifically for the Raspberry Pi.
Do note since the Raspberry Pi is an ARM device the amount of supported containers are limited. If anywhere down the dependency chain of the container we come across a library that doesn’t support the ARM architecture the container cannot build/run. Which I find to be the major pain point in running docker on the Raspberry Pi. To install the Docker-UI rpi container we do the following.
docker pull hypriot/rpi-dockerui:latest
#Pulls the latest image of the container.
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock hypriot/rpi-dockerui
#This means run the container in detached mode (-d)
expose port (-p) 9000 on host as 9000 in container (host port:container port),
mount (-v) the local docker engine socket onto the container socket.
After which if you go to
http://`raspberry pi IP`:9000/
you should be greeted with the dockerui. I will explain how to set up nginx based reverse proxying in a different post. Here is whats running on my raspberry pi’s.
I am experimenting with separating Front-End and Back-End components onto different hosts. Current my RPI2 holds Front-End components and the RPI3 holds Back-End components.