Installing Docker on Raspberry Pi 5
Docker is an open-source containerization platform written in Go and licensed under Apache License 2.0. It enables developers to package applications along with their dependencies into lightweight, portable containers that can run consistent across any Linux environment.
Manual Installation via .deb Packages
For Raspberry Pi 5 running a Debian-based OS (such as Raspberry Pi OS Bullseye), Docker can be installed by manually downloading and installing the required .deb packages.
Step 1: Download Required Packages
On the Raspberry Pi, create a directory to store the installation files:
mkdir ~/docker-install && cd ~/docker-install
Download the necessary ARM64 packages from Docker’s official repository:
curl -O https://download.docker.com/linux/debian/dists/bullseye/pool/stable/arm64/docker-ce_20.10.10~3-0~debian-bullseye_arm64.deb
curl -O https://download.docker.com/linux/debian/dists/bullseye/pool/stable/arm64/docker-ce-cli_20.10.10~3-0~debian-bullseye_arm64.deb
curl -O https://download.docker.com/linux/debian/dists/bullseye/pool/stable/arm64/containerd.io_1.4.11-1_arm64.deb
Alternatively, these files can be downloaded on another machine (e.g., Windows) from the same URL path and transferred to the Pi using tools like scp, MobaXterm, or VS Code Remote Explorer.
Step 2: Instal Dependencies
Ensure system packages are up to date and install critical dependencies:
sudo apt update
sudo apt install -y libseccomp2
Step 3: Install Docker Packages
Navigate to the download directory and install the packages in the correct order:
cd ~/docker-install
sudo dpkg -i containerd.io_1.4.11-1_arm64.deb
sudo dpkg -i docker-ce-cli_20.10.10~3-0~debian-bullseye_arm64.deb
sudo dpkg -i docker-ce_20.10.10~3-0~debian-bullseye_arm64.deb
If dependency errors occur during installation, resolve them with:
sudo apt --fix-broken install
In some cases, you may also need to explicitly install iptables:
sudo apt install -y iptables
Step 4: Verify Installation
Check the installed Docker version:
sudo docker --version
Step 5: Configure Registry Mirror (Optional but Recommended)
To improve image pull speed—especially in regions with limited access to Docker Hub—configure a mirror such as Alibaba Cloud’s registry accelerator.
Create or edit the Docker daemon configuration file:
sudo nano /etc/docker/daemon.json
Add the following content (replace the mirror URL if needed):
{
"registry-mirrors": ["https://<your-mirror-id>.mirror.aliyuncs.com"]
}
Restart Docker to apply changes:
sudo systemctl restart docker
Step 6: Test with Hello World
Run the test container to confirm everything works:
sudo docker run hello-world
If the container runs successfully and displays a confirmation message, Docker is correctly installed and configured.
Alternative: Official Installation Script
Docker provides a automated installation script (get.docker.com), but it may not always work reliably on ARM64 devices like the Raspberry Pi 5 due to architecture-specific packaging issues. Manual installation as described above is often more dependable for this platform.