How to Install Docker Engine on Ubuntu 18.04/20.04

Docker is an open-source platform for Building, Shipping and Running applications using container virtualization technology. Docker is a software package that simplifies the process of managing application processes in containers. Container technology refers to a lightweight, portable, resource friendly, stand-alone, executable package of a software that contains all the libraries, configuration files, dependencies, and other mandatory parts to operate the application. In this tutorial, learn how to Install Docker Engine on Ubuntu 18.04/20.04.

There are two versions of Docker:

  • Docker CE (Community Edition)
  • Docker EE (Enterprise Edition)

If you have a small-scale project, or you’re just learning, you can use Docker CE.

Prerequisite

  • Ubuntu 18.04/20.04operating system
  • A user with root level privilege

Method:1. Install Docker on Ubuntu Using Ubuntu Official Repositories

It’s better to update the local database of software to make sure you’ve got access to the latest revisions.

$  sudo apt update

To install Docker Engine on Ubuntu, in terminal window please enter the below command.

$  sudo apt install docker.io

The below commands will start Docker and ensure that it starts after the reboot.

$  sudo systemctl start docker
$  sudo systemctl enable docker

To verify the proper installation of Docker on Ubuntu, please enter the below commands.

$  docker --version

Method:2. Install Docker on Ubuntu Using Docker Official Repositories

Let’s update the local repository and install prerequisite dependencies.

$  sudo apt update
$  sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

We need to add GPG Key to ensure that the software you are installing is authentic and install docker repository using below command.

$  curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Once, Key and docker repository imported, update ubuntu local DB again.

$  sudo apt update

You can simply install docker CE using below command.

$  sudo apt install docker-ce 

To check docker version.

$  docker --version 

Method:3. Install Specific Version of Docker Engine (Optional)

Using below command list the available versions of Docker.

$  sudo apt-cache madison docker-ce 

We will get the all available versions of Docker. To install specific version of docker, enter below command and replace that specific version here in highlighted text.

$  sudo apt install docker-ce=<version_string>

Conclusion

Hence, in this tutorial you leaned how to install Docker Engine on Ubuntu. I hope I helped… Thanks!!

Read Also: How To Install Jenkins on Ubuntu 20.04

Share on:

Ravindra Kumar

Hi, This is Ravindra. I am founder of TheCodeCloud. I am AWS Certified Solutions Architect Associate & Certified in Oracle Cloud as well. I am DevOps and Data Science Enthusiast.

Recommended Reading..

3 thoughts on “How to Install Docker Engine on Ubuntu 18.04/20.04”

Leave a Comment