Table of Contents
Was this article helpful?

1  out of  1 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

Install Docker CE on Ubuntu 18.04 - 20.04

Last Updated: Tue, Dec 1, 2020
Containers Linux Guides Server Apps Ubuntu


Docker is an application that allows us to deploy programs that are run as containers. It was written in the popular Go programming language. This tutorial explains how to install Docker CE, and has been tested on:

  • Ubuntu 18.04 LTS
  • Ubuntu 18.10
  • Ubuntu 20.04 LTS

Uninstall old versions

Older versions of Docker were called docker, or docker-engine. If these are installed in your machine, uninstall them:

sudo apt-get remove docker docker-engine containerd runc

Updating all your software

Let’s make sure that we are using a clean system. Update the apt package index and upgrade:

sudo apt-get update && sudo apt-get upgrade -y

Set up the repository

Install packages to allow apt to use a repository over HTTPS:

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

Add Docker’s official GPG key:

curl -fsSL | sudo apt-key add -

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 by searching for the last 8 characters of the fingerprint:

sudo apt-key fingerprint 0EBFCD88


pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <>
sub rsa4096 2017-02-22 [S]

Use the following command to set up the stable repository:

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Install Docker CE

Update the apt package index:

sudo apt-get update

Install the latest version of Docker CE and containerd:

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

Create a user

The docker group is created but no users are added to it. You need to use sudo to run Docker commands. Create a non-root user which will be added to the docker group:

adduser user
usermod -aG docker user

Restart the Docker service:

systemctl restart docker

Test Docker

Run the Docker hello-world container to ensure that the installation completed successfully:

docker run hello-world


Hello from Docker!

This message shows that your installation appears to be working correctly.

Configure Docker to start on boot

Lastly, enable Docker to run when your system boots:

systemctl enable docker

Congratulations, you have successfully installed Docker. To further explore Docker, visit the official documentation to get started.

Want to contribute?

You could earn up to $300 by adding new articles