Docker is a popular open-source platform that provides functionalities to develop, ship, and run applications in containers. Containers allow you to package an application with all of its dependencies into a standardized unit for software development. This tutorial will guide you through the process of installing Docker Engine on Ubuntu 20.04.

Advertisement

Prerequisite

  • A system running Ubuntu 20.04
  • A user account with sudo privileges
  • Access to a terminal/command line

Step 1: Installing Docker Engine on Ubuntu

First of all, import the GPG key to your system to verify packages signature before installing them. To import key run the below command on terminal.

After that add the Docker repository on your Ubuntu system which contains Docker packages including its dependencies. You must have to enable this repository to install Docker on Ubuntu.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add 
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" 

Your system is now ready for Docker installation. Next, execute the following commands to upgrade apt index and then install Docker on Ubuntu 20.04 Linux system.

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

After successful installation of Docker community edition, the service will start automatically, Use below command to verify service status.

Your system is now ready for running Docker containers. Use our Docker Tutorial for Beginners to working with Docker.

Step 2 – Manage Docker Service

As usual Docker service is also managed under the Systemd daemon. You can use systemctl commands to stop, start or view status of Docker service.

Run the below command to view service status:

sudo systemctl status docker 

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-12-13 16:41:20 UTC; 1min 58s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 926989 (dockerd)
      Tasks: 8
     Memory: 35.7M
     CGroup: /system.slice/docker.service
             └─926989 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Dec 13 16:41:20 tecadmin systemd[1]: Started Docker Application Container Engine.
Dec 13 16:41:20 tecadmin dockerd[926989]: time="2023-23-13T16:41:20.247640882Z" level=info msg="API listen on /run/docker.sock"

Use below command to stop, start or restart Docker service:

sudo systemctl stop docker 
sudo systemctl start docker 
sudo systemctl restart docker 

Step 3 – Run Docker Hello World

You have successfully installed Docker on Ubuntu system. The Docker engine service is also running fine. Next, run a hello world example to verify that everything is fine.

To run Docker hello world example, open a terminal and type:

sudo docker run hello-world 

You will see the results like below. It means Docker is properly configured on your system.

how to install docker on ubuntu 20.04

Step 4 – Install Docker Compose

Download the latest version of Docker compose tool from Github. Use the below commands to download and install Docker compose 2.23.3. Before installing make sure compatibility with your docker version.

curl -L https://github.com/docker/compose/releases/download/2.23.3/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose 
chmod +x /usr/local/bin/docker-compose 

Conclusion

Congratulations! You have successfully installed Docker Engine on your Ubuntu 20.04 system. You can now begin using Docker to develop, deploy, and run applications inside containers. This installation provides a solid foundation for container-based development and deployment.

Share.

4 Comments

  1. Debabrat Panda on

    You have to run only 2 commands to install Docker in Ubuntu 20.04
    1. sudo apt update -y
    2. sudo apt install docker.io

  2. Hi,

    I try to install with difficulty Docker on Lubuntu 20.04 in DualBoot with my Windows10. My installation skip in processus to install and don’t have a good installation to work. I have this mistake 1 to 19 line END, I don’t have Have fun ! (I can work).
    thank you for your response.

Leave A Reply


Exit mobile version