Install Docker on Ubuntu 18.04

In this article, I will explain how to install Docker CE (Community Edition) on Ubuntu 18.04 Bionic Beaver. I won’t describe or explain what containers or Docker are. My assumption is that you already know the topic if you are reading this post.

Let’s start!

Remove old versions

First, we need to ensure that we don’t have old versions of Docker already installed on our machine:

Setup the repository

We install the necessary packages to use repositories on HTTPS:

We add the official Docker GPG key:

We verify the fingerprint:

Finally, we can add the repository. You might have to modify the architecture parameter based on your processor. In this example, I’m assuming you are running on a x86_64 or amd64 platform.

Install Docker CE

Update the packages index and install Docker:

Verify the installation

We will launch a container hosted in the official Docker Hub library named hello-world:

Success!

Conclusion

The installation of Docker CE on Ubuntu 18.04 is extremely easy. If you are not familiar with containers, Docker, or the cloud-native world I suggest you to start reading on these topics.

A good starting read on why you should use Docker is Using Docker of Adrian Mouat. It explains how Docker breaks the barrier between developers and operations, describing the development, testing and deployment of a web application.

If you are interest in something more detailed, you can consider Docker in Action or Docker Cookbook.

All books are available on Amazon.