Installing Docker on Ubuntu 20.04: A Guide for Setting Up Your Development Environment

Shahid Islam
2 min readJul 21, 2024

--

Docker is a powerful platform designed to simplify and streamline the process of building, deploying, and managing applications. By leveraging container technology, Docker allows developers to package applications and their dependencies into lightweight, portable containers that can run consistently across various environments.

With Docker, developers can focus more on writing code and less on managing environment inconsistencies, ultimately accelerating the software development lifecycle.

Install Docker on Ubuntu, Follow the steps:

Step1: Install docker on your host OS (Ubuntu), first check if Docker is already installed.

docker --version

if Docker is already installed, you should see output similar to
Docker version 20.10.7, build f0df350

Step 1: If Docker is not installed, you can follow these steps to install it:

#update the package index
sudo apt-get update

Step 2: Install packages to allow apt to use a repository over HTTPS

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

Step 3: Add Docker’s official GPG key:

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

# It ensure the integrity and authenticity of the Docker packages

Step 4: Set up the stable repository:

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

# The stable repository provides access to the latest stable releases of Docker.
# These versions have been tested thoroughly to ensure they work reliably in production environments.

Step 5: Update the package index again

sudo apt-get update

Step 6: Install the latest version of Docker CE (Community Edition):

sudo apt-get install docker-ce

Step 7: Verify that Docker CE is installed correctly by running the hello-world image.

sudo docker run hello-world

# it will download the hello-world image

If Docker is installed correctly, this command will print a message saying “Hello from Docker!”

Here we install Docker Community Edition (CE). It is the open-source version of Docker that is freely available to everyone. It is designed for developers and small teams who are building containerized applications. Docker CE is suitable for individual developers, open-source projects, and small-scale deployments.

--

--