The Command
sudo apt-get update && sudo apt-get upgrade -y && curl -fsSL https://get.docker.com | sudo sh && sudo usermod -aG docker $USER
Breakdown
Here’s the breakdown of it if you want to know what it does:
sudo apt-get update && sudo apt-get upgrade -y
This updates the package list and upgrades the packages on your Raspberry Pi.
curl -fsSL https://get.docker.com | sudo sh
This downloads the Docker installation script which is present at https://get.docker.com ↗️ and runs it with root privileges.
Note: Always check the script before running it with root privileges.
sudo usermod -aG docker $USER
This adds the current user to the docker group so you don’t have to use sudo every time you run docker.
You can also checkout the official documentation for installing Docker on Raspberry Pi at https://docs.docker.com/engine/install/raspberry-pi-os/ ↗️