Categories Tutorials

How to install Docker on Ubuntu Server?

How to install Docker on Ubuntu Server?

This document explains the process of Docker Installation on Ubuntu Server or Linux server.

Pre-requisites for Docker Installation

There are following pre-requisites you need to run the installation process of Docker –

  1. Ubuntu Server (Ubuntu 18.08) – with root access

Docker Installation

Please follow the installation steps below –
Ref. URL – https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04

  1. Login to the server with root access.
  2. Run following commands one by one –

a. sudo apt update

It downloads the package lists from the repositories and “updates” them to get information on the newest versions of packages and their dependencies

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

It install packages and certificates required for Docker

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

It adds GPG key for official Docker repository

d. sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”   

It adds Docker repository to APT sources

e. sudo apt update

It updates the package database with the Docker packages from the newly added repo

f. apt-cache policy docker-ce

Now, you are about to install Docker Repo instead of default Ubuntu Repo

Output of above command

docker-ce:
Installed: (none)
Candidate: 18.03.1~ce~3-0~ubuntu
Version table:
18.03.1~ce~3-0~ubuntu 500
500 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages

g. sudo apt install docker-ce
It installs Docker on your server

h. sudo systemctl status docker
Through this command, you can check status of Docker Service

Output of above command
docker.service – Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-07-05 15:08:39 UTC; 2min 55s ago
Docs: https://docs.docker.com
Main PID: 10096 (dockerd)
Tasks: 16
CGroup: /system.slice/docker.service
├─10096 /usr/bin/dockerd -H fd://
└─10113 docker-containerd –config /var/run/docker/containerd/containerd.toml