00. How to install on ubuntu
June 19, 2025Less than 1 minute
Step 1: Update packages
sudo apt update
Step 2: Install a few prerequisite packages
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Step 3: Add the GPG key for the official Docker repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Step 4: Add the Docker repository to APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
Step 5: Show detailed information about docker-ce
package
Tips
This will also update our package database with the Docker packages from the newly added repo.
Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:
apt-cache policy docker-ce
Step 6: Install Docker
sudo apt install docker-ce
Step 7: Add youself to docker
group
sudo usermod -aG docker ${USER}
Step 8: Use it
Sometimes need to relogin, then you can use the command directly, sometimes not, it depends.docker ps