[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedFebruary 21, 2023

How to Install Docker on Ubuntu 20.04

How to Install Docker on Ubuntu 20.04

Docker is an open-source containerization platform that allows you to quickly build, test, and deploy applications as portable containers that can run virtually anywhere. A container represents a runtime for a single application and includes everything the software needs to run.

Docker is an integral part of modern software development and DevOps continuous integration and deployment pipelines.

This tutorial covers how to install Docker on an Ubuntu 20.04 machine.

Docker is available for installation from the standard Ubuntu 20.04 repositories, but it may not always be the latest version. We’ll install the latest Docker package from the official Docker’s repositories.

 

Installing Docker on Ubuntu 20.04

Installing Docker on Ubuntu is fairly straightforward. We’ll enable the Docker repository, import the repository GPG key, and install the package.

First, update the packages index and install the dependencies necessary to add a new HTTPS repository :

sudo apt update

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

Import the repository’s GPG key using the following curl command:

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

Add the Docker APT repository to your system:

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

Now that the Docker repository is enabled, you can install any Docker version that is available in the repositories.

  1. To install the latest version of Docker, run the commands below. If you want to install a specific Docker version, skip this step and go to the next one.
  2. sudo apt update

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

  1. To install a specific version, first list all the available versions in the Docker repository:
  2. sudo apt update

apt list -a docker-ce

The available Docker versions are printed in the second column. At the time of writing this article, there is only one Docker version (5:19.03.9~3-0~ubuntu-focal) available in the official Docker repositories.

Output

docker-ce/focal 5:19.03.9~3-0~ubuntu-focal amd64

Install a specific version by adding =<VERSION> after the package name:

sudo apt install docker-ce=<VERSION> docker-ce-cli=<VERSION> containerd.io

Once the installation is completed, the Docker service will start automatically. You can verify it by typing:

sudo systemctl status docker

The output will look something like this:

● docker.service – Docker Application Container Engine

Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)

Active: active (running) since Wed 2023-01-04 21:22:39 CET; 50s ago

TriggeredBy: ● docker.socket

Docs: https://docs.docker.com

Main PID: 8753 (dockerd)

Tasks: 14

Memory: 24.5M

CGroup: /system.slice/docker.service

└─8753 /usr/bin/dockerd -H fd:// –containerd=/run/containerd/containerd.sock

When a new version of Docker is released, you can update the packages using the standard sudo apt update && sudo apt upgrade procedure.

If you want to prevent the Docker package from being updated, mark it as held back:

sudo apt-mark hold docker-ce

 

Executing Docker Commands as a Non-Root User

By default, only root and user with sudo privileges can execute Docker commands.

To execute Docker commands as non-root user you’ll need to add your user to the docker group that is created during the installation of the Docker CE package. To do that, type in:

sudo usermod -aG docker $USER

$USER is an environment variable that holds your username.

Log out and log back in so that the group membership is refreshed.

 

Uninstalling Docker

Before uninstalling Docker it is a good idea to remove all containers, images, volumes, and networks .

Run the following commands to stop all running containers and remove all docker objects:

docker container stop $(docker container ls -aq)docker system prune -a –volumes

You can now uninstall Docker as any other package installed with apt:

sudo apt purge docker-cesudo apt autoremove

Keep reading
How to Install and Use Curl on Ubuntu 20.04.
September 11, 2023

How to Install and Use Curl on Ubuntu 20.04.

How To Install And Use Curl On Ubuntu 20.04. This article explains how to install Curl on Ubuntu 20.04. curl is a command-line utility for transferring data from or to a remote server. With curl, you can download or upload data using one of the supported protocols, including HTTP, HTTPS, SCP ,…

Read article
How to make a POST request with cURL.
September 11, 2023

How to make a POST request with cURL.

How To Make A POST Request With CURL. In this article, we’re going to explain how to use cURL to make POST requests. The HTTP POST method is used to send data to the remote server. cURL is a command-line utility for transferring data from or to a remote server using one of the supported…

Read article
How to Setup Automatic Kernel.
September 11, 2023

How to Setup Automatic Kernel.

How To Setup Automatic Kernel. This article explains how to set up automatic rebootless kernel updates using the live patching solutions from Canonical and CloudLinux. Canonical Livepatch Canonical Livepatch is a service that patches the running kernel without having to reboot your Ubuntu system.…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00