Skip to main content

ARM Docker

TST, Hong Kong

Happy Pi Day with Docker and Raspberry Pi

Preparing the RaspberryPI

I am downloading a Raspberry Pi 3B+ compatible Debian Bullseye Image and bring it onto an SD card. To activate the SSH service you are have to add an empty file ssh to the boot directory - though remote logins are deactivated by default and need to be configured by attaching a keyboard and monitor. There should be a way to do this by a post-install script, but I could not find it on a quick skim:

cd /run/media/myuser/RASPIROOT/boot/
touch ssh

To activate the login first generate a password for the root account by running:

passwd

And edit the following line in /etc/ssh/sshd_config:

# FROM:
# PermitRootLogin without-password
# TO:
PermitRootLogin yes

Now restart the SSH daemon with:

systemctl sshd restart
systemctl sshd status

Installing Docker

Install the following prerequisites:

apt update && apt upgrade -y
apt install curl apt-transport-https ca-certificates software-properties-common -y

Import Docker CPG key (I think this isautomatically done by the install script below):

curl -fsSL https://download.docker.com/linux/raspbian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Use the following command to set up the repository:

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian/ \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

Download and install Docker:

curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Become root-less:

sudo usermod -aG docker $USER
newgrp docker

Make sure the service is enabled and started (should already have happened by the install script):

systemctl enable docker.service
systemctl start docker.service
service docker status

Verify everything is in order:

docker info

Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.10.2
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.15.1
Path: /usr/libexec/docker/cli-plugins/docker-compose

...

Kernel Version: 5.10.0-21-arm64
Operating System: Debian GNU/Linux 11 (bullseye)
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 906.6MiB
Name: rpi3-20230102

👍

If you need it run modprobe to load the kernel modules for iptables - e.g. for the Open Thread Edge Router:

sudo modprobe ip_tables
sudo modprobe ip6table_filter