sudo chmod a+r /etc/apt/keyrings/docker.asc
Table of Contents
Add the repository to apt sources:
Installing Docker on Raspberry Pi OS is quite straightforward, thanks to a handy installation script provided by Docker. sudo install -m 0755 -d /etc/apt/keyrings
If you are new to Docker, you should check out this Docker course from our other website.docker run hello-world
Whether you’re building a mini server, automating tasks, or just tinkering for fun, Docker has unlimited usage.There are two ways of doing it:
- Use a script provided by Docker and let it handle the things
- Use the traditional Debian way of adding repositories, GPG key to your system and then install the Docker package.
You can share your experiences with us in the comment section below.When you combine Docker with the compact, affordable Raspberry Pi, you’ve got a powerful setup that’s perfect for both developers and hobbyists. docker --version
But If you’re serious about running Docker containers, especially multiple ones simultaneously, you’ll want to invest in a model with at least 4GB of RAM. Believe me, your Pi will thank you.
Add Docker’s official GPG key
sudo usermod -aG docker $USER
groups
Step 4: Verify the installation
Congratulations! You’ve successfully installed Docker on your Raspberry Pi. Now you can start exploring Docker containers, pulling images from Docker Hub, and even creating your own Dockerized applications. Before diving into the Docker installation, it’s a good practice to ensure your Raspberry Pi OS is up-to-date. Open a terminal and run the following commands:To make things more convenient, you can add your user to the Docker group, which allows you to run Docker commands without needing sudo
.Download Docker’s GPG Key:
Install Docker package
sudo apt install docker docker-compose -y
Step 3: Setting up the user for Docker
curl -sSL https://get.docker.com | sh
In both cases, you need to install some dependencies first:You can check if the user has been added successfully or not:While the Raspberry Pi is a fantastic platform for learning and experimenting, remember that a little extra horsepower can go a long way.
Next, create a directory for Docker’s GPG Key:This guide will show you how to get Docker up and running on your Raspberry Pi in no time.To further confirm Docker is up and running, try running the “Hello World” container:
So, there you have it—Docker on your Raspberry Pi. Newer version of Docker has the compose subcommand. But most tutorials on the web still use the older Python-based docker-compose, so install that as well.
Run the following command to add your user to the Docker group:
Do more with Docker
sudo curl -fsSL https://download.docker.com/linux/raspbian/gpg -o /etc/apt/keyrings/docker.asc
sudo apt install ca-certificates curl
Method 1: Use the official script to install Docker
The first step remains the same as above regarding the Installation of required packages.
- Permission Issues: Make sure you’ve added your user to the Docker group and rebooted your Pi.
- Outdated Packages: If Docker doesn’t install correctly, double-check that your system is fully updated.
- Limited Resources: The Raspberry Pi, especially older models, has limited RAM and CPU power, so be mindful of the containers you run simultaneously.
Final Thoughts
sudo apt update && sudo apt upgrade -y
If you run into any issues, here are a few common solutions:Here are a few ideas to get you started:If you want to take a long route and install via apt
repository you need to setup few things first like adding the docker repository: