Installation Guide for Latest Docker and Docker-Compose Version on Ubuntu Linux

Docker is a free and open source tool designed to build, deploy, and run applications inside containers. Host on which docker is installed is known docker engine. To work the docker engine smoothly, docker daemon service must always be running. For the applications where multiple containers are used then with the help of docker compose these containers are spin up as a service.

In this guide, we will demonstrate docker installation on Ubuntu 20.04 /20.10 and will also learn about docker compose installation and its usage.



  • Sudo user with privilege rights
  • Stable Internet Connection

Let’s dive into Docker installation steps on Ubuntu 20.04 /20.10

Step 1: Install prerequisites packages for docker

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

Step 2: Setup docker official repository

$ curl -fsSL | sudo apt-key add -
$ sudo add-apt-repository \
"deb [arch=amd64] \
$(lsb_release -cs) stable"

Step 3: Install docker with apt command

$ sudo apt-get update
$ sudo apt install docker-ce -y

Once the docker package is installed, add your local user to docker group by running following command:

$ sudo usermod -aG docker jainhemant
$ sudo usermod -aG docker root

Note: Make sure logout and login again after adding local user to docker group

Verify the Docker version by executing following,

$ docker version

Verify whether docker daemon service is running or not by executing below systemctl command,

$ sudo systemctl status docker

Above output confirms that docker daemon service is up and running.

Step 4: Verify docker Installation

$ docker run hello-world

This docker command will download ‘hello-world’ container image and then will spin up a container. If container displays the informational message, then we can say docker installation is successful. Output of above ‘docker run’ would look like below.

Installation of Docker Compose on Ubuntu 20.04 / 20.10

$ sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

Check the docker-compose version by running following command,

$ docker-compose --version
docker-compose version 1.29.0, build cabd5cfb

Perfect, above output confirms that docker compose of version 1.29.0 is installed.

Test Docker Compose Installation

$ mkdir wordpress
$ cd wordpress

Create a docker-compose.yaml file with following contents.

$ vi docker-compose.yaml
version: '3.3'

image: mysql:latest
- db_data:/var/lib/mysql
restart: always
MYSQL_DATABASE: wordpress_db
MYSQL_USER: dbuser
MYSQL_PASSWORD: dbpass@123#
- db
image: wordpress:latest
- "8000:80"
restart: always
WORDPRESS_DB_NAME: wordpress_db
db_data: {}

Save and close the file.

As we can see, we have used two containers one for WordPress web and other one is for Database. We are also creating the persistent volume for DB container and WordPress GUI is exposed on ‘8000’ port.

To deploy the WordPress, run the below command from your project’s directory

$ docker-compose up -d

Output of above command would like below:

Above confirms that two containers are created successfully. Now try to access WordPress from the Web Browser by typing URL:


Great, above confirms that WordPress installation is started via docker-compose. Click on Continue and follow screen instructions to finish the installation.

That’s all from this guide. I hope you found this guide informative, please don’t hesitate to share your feedback and comments.

For more documentation on docker please refer : Docker Documentation

Young budding Professional Graduate Student interested in Cloud Computing and Big Data Processing and Optimization.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store