How to install Docker on Ubuntu 18.04 / 19.04 / 16.04

How to install Docker on Ubuntu 18.04 / 19.04 / 16.04 Linux distributions. Docker Engine is a container runtime engine that enables you to package applications with all its dependencies into a standardized unit for software development and distribution.

Docker containers wrap a piece of software in a complete file system that contains everything it needs to run: code, run, System Tools, System library – Everything you can install on the server. This ensures that it will always run the same content no matter what environment it is running in.

Please follow these steps to install Docker on Ubuntu 19.04 / 18.04 / 16.04.

Step 1: Update the system

Make sure the system is updated.

sudo apt -y update

Step 2: Install basic dependencies

We need few dependencies to configure the Docker repository and do the actual package installation. Install them by triggering the following commands in the terminal.

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

Step 3: Install Docker CE on Ubuntu 18.04 / 19.04 / 16.04

If you have an older version of Docker, remove it and its related packages.

sudo apt remove docker docker-engine docker.io containerd runc

Import the Docker repository GPG key:

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

Add the Docker CE repository to Ubuntu:

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

Finally install Docker CE on Ubuntu 18.04 / 19.04 / 16.04:

sudo apt update
sudo apt -y install docker-ce docker-ce-cli containerd.io

Add your user account to the docker group.

sudo usermod -aG docker $USER
newgrp docker

Verify the installation by checking the Docker version:

$ docker version
Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:29:11 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.8
  Git commit:       6a30dfc
  Built:            Thu Aug 29 05:27:45 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Step 4: Install Docker Compose on Ubuntu 18.04 / 19.04 / 16.04

The installation of Docker Compose is optional. For users who use it, please follow the guide below to install it.

How to install the latest Docker Compose on Linux

More articles:

Install Docker UI Manager – Portainer

Ctop-the highest order for container indicators

How to set up Docker Private Registry on Ubuntu 18.04 / Ubuntu 16.04 with Letsencrypt

Install and configure Docker registry on CentOS 7

How to use K3 to deploy a lightweight Kubernetes cluster in 5 minutes

Sidebar