Step 1: Uninstall Old Versions
sudo apt-get remove docker docker-engine http://docker.io containerd runc
Step 2: Update apt package and install dependencies
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
Step 3: Add Docker's official GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Step 4: Setup the repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Step 5: Install Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli http://containerd.io docker-compose-plugin
Step 6: Test the Installation
sudo service docker start
sudo docker run hello-world
Step 7: Add your user to the Docker group
sudo usermod -aG docker $USER
PS: when you log out and back in, you should be able to run docker commands without sudo
Now Docker has been successfully installed on your Ubuntu system 🍻
Top comments (0)