The Raspberry Pi 5 is a powerful and compact device, making it an excellent choice for hosting lightweight applications using Docker containers. In this guide, we’ll walk you through setting up your Raspberry Pi from scratch, installing an operating system, enabling remote access via SSH, and finally, setting up Docker to run your containers efficiently. Whether you’re a beginner or an experienced tinkerer, this tutorial will help you get your Raspberry Pi 5 up and running as a Docker host in no time!
If you don’t have a Raspberry Pi yet, check out our review of the Pi 5.
The first thing we need to do is to install an operating system into our Raspberry Pi, for that we will need an SD card, and the Raspberry Pi imager, which you can get here. After downloading the imager, open it and follow the steps below:
Now insert your SD card into the Raspberry Pi, plug in an Ethernet cable, and give it power. After a while, you should then be greeted with a login screen:
In the previous chapter, we enabled SSH before flashing, this means that you should be able to connect to your Raspberry Pi without any other setup. For that, we will then need to find its IP address, you can do that on your router, like this:
Or on the Pi itself, by installing net tools and running ‘ifconfig’:
sudo apt install net-tools
ifconfig
If you see multiple adapters, look for ‘eth0’ or a similar name and copy the IP after ‘inet’:
After grabbing the IP, you can now connect to your Pi by running:
ssh username@yourip
If you want to access your Pi without having to type your password every time, you can add your ssh keys. Doing that is pretty easy, go to your remote computer and run:
ssh-copy-id username@yourip
If you don’t have any keys to add, you can learn how to generate one in this article.
Before we can install the community version of docker, we need to add its repository to APT. We can do that by running the following commands:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
After the repository is added, you can then install docker with the following command:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
After that, you need to add your user to the docker group to be able to run docker commands without ‘sudo’ and then, restart your computer.
sudo groupadd docker
sudo usermod -aG docker $USER
sudo reboot
Now that we have docker installed, let’s try it out! On your terminal, run the command below to test docker:
docker run hello-world
If you see an output similar to the one below, then you set up everything correctly:

And that’s all, thanks for reading and stay tuned for more tech insights and tutorials. Until next time, and keep exploring the world of tech!