What is Docker?

Docker is an increasingly popular software package that creates a container for application development.

Essentially, it creates a smooth operating system interface, so that applications running on it are compatible with most operating systems. Developing in Docker also helps speed up applications, since it shares the kernel and other resources (instead of pulling dedicated resources just for the application).

There are two versions of Docker – Docker CE (Community Edition) and Docker EE (Enterprise Edition).  If you’ve got a small-scale project, or you’re just learning, you’ll want to use Docker CE.  The Enterprise version is fee-based, so you’ll need to have an existing subscription to install it.

In this tutorial, we will cover how to install Docker on an Ubuntu 18.04 machine.


Docker CE:

  • Ubuntu 18.04 64-bit operating system
  • A user account with sudo privileges
  • Internet access
  • Command line / terminal (CTRL-ALT-T or Applications menu > Accessories > Terminal)


  • Software installer APT
  • Docker software repositories (optional)

Install Docker Using Ubuntu Default Repositories

Step 1: Update Software Repositories

As usual, it’s a good idea to update the local database of software to make sure you’ve got access to the latest revisions.  Open a terminal window and type:

sudo apt-get update

Allow the operation to complete.

Step 2: Uninstall Old Versions

It’s recommended to uninstall any old Docker software before proceeding.  At the terminal window, type:

sudo apt-get remove docker docker-engine docker.io

Allow the operation to complete.  If Docker is not installed, the system may come back and tell you so, and that’s perfectly OK.

Step 3: Install Docker

In the terminal window, type:

sudo apt install docker.io

Allow the operation to complete.

Step 4: Start and Automate Docker

In the terminal window, type in each command followed by the enter key:

sudo systemctl start docker

sudo systemctl enable docker

The first command starts the Docker service. The second command sets Docker to run at startup.

Step 5 (Optional): Check Docker Version

In a command window, type:

docker --version

The system should return with the Docker version number.

As of this article, the official Docker website does not offer support for Ubuntu 18.04, and it’s possible that the Ubuntu default repositories have not updated to the latest revision.  There’s nothing wrong with running this installation. However, if you are up for a slightly more intensive operation, you can install a more recent (or specific) Docker from the official Docker repositories.

Alternative Option: Install Docker from Official Repository

Step 1: Update Local Database

sudo apt-get update

Let the operation complete.

Step 2: Download Dependencies

You’ll need to run these commands to allow your operating system to access the Docker repositories over HTTPS.  In the terminal window, type:

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

Here’s a brief breakdown of each command:

  • apt-transport-https:  Allows the package manager to transfer files and data over https
  • ca-certificates:  Allows the system (and web browser) to check security certificates
  • curl:  This is a tool for transferring data
  • software-properties-common:  Adds scripts for managing software

Step 3: Add Docker’s GPG Key

The GPG key is a security feature, to ensure that the software you’re installing is authentic.  In a terminal window, type:

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

Step 4: Install the Docker Repository

In the terminal window, type:

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

The command “$(lsb_release –cs)” scans and returns the codename of your Ubuntu installation – in this case, Bionic. Also, the final word of the command – stable– is the type of Docker release. A stable release is tested and confirmed to work, but updates are released less frequently. You may substitute edge if you’d like more frequent updates, at the cost of potential instability. There are other repositories, but they are riskier – more info can be found on the Docker web page.

Step 5: Update Repositories

Don’t skip this one! You will want to update the repositories you just added.

sudo apt-get update

Step 6: Install Latest Version of Docker

In the terminal window, type:

sudo apt-get install docker-ce

Allow the operation to complete.

Step 7 (Optional): Install Specific Version of Docker 

List the available versions of Docker by entering the following in a terminal window:

apt-cache madison docker-ce

docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

The system should return a list of available versions. In your terminal, type:

sudo apt-get install docker-ce=<VERSION>

Substitute <VERSION> for the version you want to install (pulled from the list you just generated).

Step 8 (Optional): Install from a .deb Package

Open a web browser, and go to the following location


Click on the pool link, then stable, then amd64.  This is the location of the stable Docker releases for Ubuntu 18.04.  At the time this article was written, this directory was empty. This indicates that there are no verified stable releases for Ubuntu 18.04.

Not to worry, though! The previous versions should work just fine. Alternatively, you can install an edge release by browsing to:


Download the file, and make a note of the path where you saved it.

In your terminal window, type:

sudo dpkg -i /path/to/package.deb

Substitute your file location for /path/to/package.deb. Allow the installer to run.


Great job!  You’ve got three (3) different options for installing Docker on Ubuntu 18.04.

You can check the Docker guides if you get into trouble, plus they have a fairly robust forum you can search. Happy developing!