Running Docker on a Raspberry Pi

I’ve been playing around with Docker and containers for the last year or so, primarily by running Docker Desktop on my Windows 10 device and experimenting with Azure Container Instances. I even shared one of the containers that I created on GitHub – https://github.com/brendankarl/Containers, a super-advanced Workout Generator app 😀.

As I have more Raspberry Pi’s than I care to admit, I’m always looking for new ways to use them and reduce the guilt I feel when I see them abandoned on my desk.

I’d read that you could run Docker on a Raspberry Pi, however I’d never got round to playing around with this…and to honest I expected it to be a bit of a palaver.

I was pleasantly surprised how easy it was to get Docker installed and my first container running on a Pi – it took a mere six commands!

sudo apt-get update && sudo apt-get upgrade
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker ${USER}
sudo pip3 install docker-compose
sudo systemctl enable docker
sudo docker run -d -p 80:80 hypriot/rpi-busybox-httpd

This installs Docker and Docker Compose, enables Docker to startup automatically on boot and runs the https://github.com/hypriot/rpi-busybox-httpd image, which is a straightforward way to verify that Docker is working correctly (by running a lightweight web server). Once these commands finished executing, I launched a browser and connected to the IP of my Pi and was greeted with this – success!

As a side note Visual Studio Code with the Remote Development and Docker extensions is a great way to do remote development and manage Docker on a Raspberry Pi from Windows or Mac.

One thought on “Running Docker on a Raspberry Pi

Comments are closed.