Guide on how to get Docker up and running on your Raspberry Pi. The proper way.
Step-by-step tutorial on how to install Docker, add docker-compose, launch the first dockerized application, and set up Docker to launch on system startup automatically.
Log in to Raspberry Pi and
Quick update of our Pi:
sudo apt update && sudo apt upgrade
Download and install Docker according to its developers with all appropriate stuff:
curl -sSL https://get.docker.com | sh
Now we need to add our user to the “docker” group.
sudo usermod -aG docker ${USER}
Note that in 2022 installing docker-compose isn’t necessarily needed. Docker itself now can manage a lot of this stuff through its “docker compose” command.
Anyway:
As a next step, we want to install docker-compose, shortest route to do that is via pip – that’s the package installer for python.
sudo apt-get install python3 python3-pip
now it’s time to use pip to install docker-compose.
sudo pip3 install docker-compose
We need to relog to our raspberry so the changes made to groups propagate in the right way.
exit
and relog to Raspberry Pi.
Try to run the first docker container.
A simple hello world application will suffice.
docker run hello-world
Last thing to do here is to enable Docker to launch on system startup:
sudo systemctl enable docker
And that’s all, pretty straightforward, right?
So that’s Docker on Raspberry Pi. Hope it helped!
If you find these guides at least a little bit helpful please do check out my YouTube channel.