How to install docker on Raspberry Pi?
I recently came across a requirement where I needed to install docker on a raspberry pi and ran into an installation issue that I wanted to discuss so that it is easier for others who attempt this installation. You may have found many sources on the internet on how you can install docker on the raspberry pi. The steps are provided below.
You will need to upgrade to Raspbian OS version buster if you are running into issues as mentioned here.
Update the repository package list using `sudo apt update`.
Upgrade the distro using `sudo apt dist-upgrade -y`.
Update the firmware using `sudo rpi-update`.
Edit the sources to switch repositories that point to buster.
sudo nano /etc/apt/sources.list
Browse the file until you find: "deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi"
Change this line by replacing stretch with buster: "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi"
Press Ctrl+X to save and exit, then remove a large changelog file: `sudo apt-get remove apt-listchanges`. This will save time when the operating system updates.
With the sources updated you can run a full package update and upgrade: `sudo apt update; sudo apt dist-upgrade`.
Clean up the package manager using `sudo apt autoremove -y`.
Discard old packages with changed dependencies using: `sudo apt autoclean`.
Reboot the pi using `sudo reboot`.
Once the Raspberry Pi is up, you can install docker using the following steps:
sudo apt-get update && sudo apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Add a non-root user to the docker group: sudo usermod -aG docker [user_name]
Check docker verison: `docker version`.
Check docker info: `docker info`.
Run docker hello-world: `docker run hello-world`
Sources:
Hope this helps! ☺️