Install Docker CE on Ubuntu 18.04

Docker is a special application that allows you to deploy and install programs that run as containers. This application was written in Go – a programming language.

Delete old versions

Older versions are called docker.io or otherwise docker-engine. If they are still installed, then they must be removed:

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

Software update

Update apt package index:

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

Configure storage

Install packages to allow apt to use storage on top of HTTPS:

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

Add the official docker key:

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

Make sure there is a key with fingerprints 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88. You need to search for the last 8 characters of the fingerprint:

sudo apt-key fingerprint 0EBFCD88

Output

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

For stable repository setup, you can use the following command:

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

Install Docker

Update apt package index

sudo apt-get update

Then you need to install the latest version of Docker CE and containerd

sudo apt-get install docker-ce docker-ce-cli containerd.io

Create user

You need to use sudo to run Docker. Create a user using the following commands:

adduser user
usermod -aG docker user

Restart the Docker service:

systemctl restart docker

Was this article helpful?

Related Articles

Leave A Comment?