Install Docker in Ubuntu

Install Docker in Ubuntu

- in Devnet, Linux

In this article we will learn how to install Docker on an Ubuntu 20.04 operating system.

1.-Installing the initial requirements with the following commands.

sudo apt-get update
sudo apt-get install \\
 apt-transport-https \\
 ca-certificates \\
 curl \\
 gnupg-agent \\

2.- Add Docker’s official GPG key:

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

3.- Add the Docker repository:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4.- We update and install the latest version of Docker:

 sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli

5.- Verify the Docker version:

sudo docker version

6.- Execute the hello-world image to validate that Docker works:

sudo docker run hello-world

7.- Run Docker commands without sudo:

If you want to avoid typing sudo every time you run a docker related command, run the following command:

sudo usermod -aG docker ${USER}

Finally, apply the changes to the group, log out of your current session and log back in, or type the following command:

su - ${USER}

You will be prompted to enter the user’s password to continue.

Confirm that your user has been added to the Docker group.

id -nG

More information about installing Docker on different Linux distributions

Facebook Comments

You may also like

Autonomous System Numbers – BGP

There are two types of BGP Autonomous system