To install Docker on Ubuntu, kindly follow these steps:
- Open a Terminal window and update the package index by running the following command: sudo apt update
- Install the dependencies required to add a new package repository over HTTPS by running the following command: sudo apt install apt-transport-https ca-certificates curl software-properties-common
- Add the GPG key for the official Docker package repository to your system by running the following command: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Add the Docker package repository to your system by running the following command: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- Update the package index again and install Docker by running the following command: sudo apt update
sudo apt install docker-ce - Once the installation is complete, start the Docker service by running the following command: sudo systemctl start docker
You can confirm that Docker is running by running the following command: sudo systemctl status docker
Alternatively, you can also install Docker using the convenience script provided by Docker by running the following command in a Terminal window: curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
Note: These instructions are for Ubuntu 20.04. If you are using a different version of Ubuntu, you may need to adjust the commands accordingly.