Install docker ubuntu 18.04

Install docker ubuntu 18.04

Installing Docker on Ubuntu 18.04

Docker is a set of PAAS (Platform as a service) Products that uses virtualization to deliver “containers” that you can use to easily install and run software / Applications. This guide will teach you how to install docker on Ubuntu 18.04

There are different ways you can install docker, In this guide I am going to be showing you two ways you can install docker on an Ubuntu 18.04 Machine


  • An Ubuntu Machine (In this guide I am using Ubuntu 18.04 Server)

  • Root / Sudo Access

  • Access to commandline / terminal

Installation Method 1

This method will install docker from the official repository

Update System

You will first need to update your system to make installs more reliable and safer, This command will download package information from all the configured sources on your machine which can be located in /etc/apt/sources.list and can be also found in /etc/apt/sources.list.d/. You can update your system by running sudo apt update

Then you will need to install the following package which allows apt to install packages over https

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

Next, we need to install Docker from the official repository but before we do that we need to add dockers GPG key which ensures that we are installing the authentic docker version. You can do this by running

curl -fsSL | sudo apt-key add –

Now to install the docker repository you need to run

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

”$(lsb_release –cs)” Scans your machine and returns the installation type of your machine so it installs the correct docker version that is compatible with your machine and stable just means that it is installing the stable version of docker

Now you will update the packages on your machine again by running

sudo apt-get update

Now we will install the docker package by running,

sudo apt-get install docker-ce

Now you have installed docker, so if you run

docker --version

The version of docker should return, for example in my case the version was 19.03.12

Installation Method 2

As always the first thing you should do before you install a package is to ensure your packages are up to date by running

sudo apt-get update

Just to be on the safe side you will just double-check that docker is not already installed and if it is you will uninstall them, You can do this by running

sudo apt-get remove docker docker-engine

Now to install docker you can run the command

sudo apt install

To ensure docker starts automatically when the computer turns on you will need to add it to the system services, You can do this by running

sudo systemctl start docker


sudo systemctl enable docker

To verify docker is installed successfully you can run

docker --version

Now thats it, You have successfully installed docker on Ubuntu 18.04

© 2020. All rights reserved.