Docker is a software platform that simplifies the process of building, running, managing and distributing applications. It does this by virtualizing the operating system of the computer on which it is installed and running.
Prerequisites:
Ubuntu 20.04 or higher
A non-root user with sudo privileges
Step 1: Update package list
The first step is to update the package list on the Ubuntu machine. This is done by running the following command in the terminal:
$ sudo apt update
Step 2: Install packages to allow apt to use a repository over HTTPS
Next, we will install the necessary packages to allow apt to use a repository over HTTPS:
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Step 3: Add Docker's official GPG key
To add Docker's official GPG key, run the following command in the terminal:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Step 4: Add the stable Docker repository to the system
To add the stable Docker repository to the system, run the following command:
$ echo "deb [arch=$(dpkg --print-architecture) 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
Step 5: Update package list again and install Docker CE
$ sudo apt update
$ apt-cache policy docker-ce
Step 6: Finally install Docker
$ sudo apt install docker-ce
Top comments (0)