Quickly Configure Docker and Docker Compose on Raspberry Pi

The following instructions have been tested on the Raspberry Pi Zero W, 2B, 3, and 4.

Install Docker

# Fetch and run installation script
curl -sSL https://get.docker.com | sh

# Add the pi user to the docker group
# After this command, remember to logout or restart for usermod to take effect
sudo usermod -aG docker pi # Or `sudo usermod -aG docker ${USER}`

# Test a container
docker run hello-world

# The hello-world image may not work on armv6 processors like the Raspberry Pi Zero. In order to run it, you will need to target a lower arm version.

Install docker-compose

# Install the required dependencies and python packages first
sudo apt install -y libffi-dev libssl-dev python3-dev python3 python3-pip

# Install docker-compose through pip3 (the python package manager)
sudo pip3 install docker-compose

Leave a Reply

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