Installing Docker on Raspberry Pi

Add following parameters in /boot/cmdline.txt

cgroup_enable=memory cgroup_memory=1

for example editing with nano

sudo nano /boot/cmdline.txt  

and reboot raspberry pi

sudo reboot

Now install docker

sudo apt-get update 
sudo apt-get dist-upgrade
curl -sSL -o
sudo usermod -aG docker pi

It makes sense to install Portainer for managing docker inside of a website http://raspberrypi.local:9000/

Installing Portainer can be done in docker itself (

docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

See official Images for supported architectures:
arm32v5 in theory all Raspberry Pi models
arm32v6 like Raspberry Pi Zero
arm32v7 like Raspberry Pi 3 or 4
arm64v8 like Raspberry Pi 4 in 64-bit mode

Old Images:
armhf in theory all Raspberry Pi models

Available Images on Balena:

Example running a web server on Raspberry Pi Zero W with the HTML files in /home/pi/html

docker pull arm32v6/nginx:alpine
sudo docker run --name nginx -d -p 80:80 -v /home/pi/html:/usr/share/nginx/html:ro -d arm32v6/nginx:alpine

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.