Installed docker on raspberry pi 3b, OS version 11/bullseye. In the next post we will install pihole in docker.
Followed the link https://docs.docker.com/engine/install/raspberry-pi-os/
First we need to remove all unofficial packages, so type the following command. You may not have any packages installed, but let’s do it.
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
Code language: JavaScript (javascript)
There are different methods to install docker, but we will use docker’s apt repository method .
Install using apt repository
Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker apt
repository. Afterward, you can install and update Docker from the repository.
1.Setup docker’s apt repository
# 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/raspbian/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/raspbian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Code language: PHP (php)
2. Install latest packages
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Code language: JavaScript (javascript)
3. Verify that the installation is successful by running the hello-world
image:
sudo docker run hello-world
Uninstall docker, docker-compose
- Uninstall docker engine, cli, containerd and docker compose packages
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
Code language: JavaScript (javascript)
2.Remove directories where images, volumes and containers are stored
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
Code language: JavaScript (javascript)
3.Finally remove source keys and keyrings
sudo rm /etc/apt/sources.list.d/docker.list
sudo rm /etc/apt/keyrings/docker.asc
Code language: PHP (php)