How to Install Docker on Ubuntu
To install Docker on Ubuntu, you can follow the simple steps below:
- Update the apt package index:
- Install the packages necessary to allow apt to use a repository over HTTPS:
- Add Docker’s official GPG key:
- Set up the stable Docker repository:
- Update the apt package index again:
- Install Docker:
- Verify that Docker has been installed correctly:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
This should display a message confirming that Docker has been installed and is running correctly.
That’s it, docker is installed.