How To Install Docker On Ubuntu 20.04 LTS?

How To Install Docker On Ubuntu 20.04 LTS?

   

This post was last updated on August 1st, 2020 at 08:47 pm

Docker is a platform that makes it easier to create, deploy, and use an application using containers. A container contains an application with all parts of it needed such as libraries and other dependencies, and ships it as one package.

Instead of using dedicated resources like virtual machines, docker shares kernel, and other resources of the host system. There are two versions of the Docker: Docker CE(Community Edition), Docker EE (Enterprise Edition). Docker CE is a community-supported version available for free. You can use it for small scale projects or learning.

This article describes how to install and use Docker CE on Ubuntu 20.04 LTS.

Install Docker CE from Docker’s official repository

You can install it from the standard Ubuntu repository but you may not get its latest version. So we will install it from the docker’s official repository.

Setup docker’s official repository

Before we start installing docker we need to set up its official repository, so that we can install and upgrade it easily. Follow the below steps –

First, update the apt package index by using –

sudo apt update

Install the following packages to allow apt to use a repository over HTTPS –

sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-comman

Now add the official GPG key of docker –

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the docker stable repository to apt sources, remember to replace the architecture and name of the distribution with your own –

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Now again run the apt update command –

sudo apt update

Install Docker CE

Install the community edition of Docker using the following command –

sudo apt install docker-ce

You can verify the installation by using –

docker --version

Test the docker with hello-world container

You can test the docker by running the hello-world container on Ubuntu 20.04 LTS. Use the following command in your terminal –

sudo docker run hello-world

If the message appears like given in the image that means docker installed in your system is working correctly.

If you want to run docker command without sudo, you need to add your username to the docker group. You can use the following command to add a user to the docker group –

sudo usermod -aG docker {username}

For example –

sudo usermod -aG docker lalit

Now log out and re-login or use the following command to apply the membership of the user.

su {username}

This will ask the password of the current user, enter it. Now you can run the docker command without sudo.

Conclusion

If you want to know more about the options and commands that can be used with the docker then run docker command without any argument. This will display the complete list of options and commands. You can also see its manual page by executing man docker in the terminal.

Previous What Is Buzz B Gone?
Next [ubuntu] Bluetooth not working

About author

You might also like

How To 0 Comments

How To Install And Configure Gnome Desktop in FreeBSD?

This post was last updated on August 1st, 2020 at 12:05 pmFreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution. It is used to power

Linux Topics 0 Comments

Process Management In Linux/Unix

This post was last updated on August 3rd, 2020 at 03:06 pmA process is an instance of a computer program that is currently running. A program can have multiple instances

How To 0 Comments

How To Split A Large File Into Multiple Smaller Files In Linux/Unix?

This post was last updated on August 1st, 2020 at 12:32 pmSuppose you have an archive file of size more than 5GB, and if you want to burn it on

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply