Categories: Ubuntu

How To Install Docker On Ubuntu 22.04|20.04|18.04

Docker is a platform that enables developers to easily create, deploy, and run applications in containers. Containers are a lightweight form of virtualization that allow an application and its dependencies to be packaged together in a single container. This makes it easy to move the application between different environments, such as between development and production, without having to worry about compatibility issues.

Docker provides a number of tools for managing containers, including the Docker Engine. Which is the core component that runs the containers, and the Docker Hub, which is a public registry for sharing container images. Additionally, Docker provides a command-line interface (CLI) for interacting with the Docker Engine and managing containers.

In this article you will learn that how to install docker on ubuntu in simple steps.

Before we begin, make sure you have a user account with administrative privileges on your Ubuntu system.

Step 1: Update the package index

The first step is to update the package index by running the following command in the terminal:

sudo apt update

This command will update the package index on your system to ensure that you have the latest versions of packages available.

Step 2: Install dependencies

To add a new repository over HTTPS, we need to install some dependencies. Run the following command in the terminal:

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

This command will install the necessary packages to add a new repository over HTTPS.

Step 3: Add the Docker repository

To add the Docker repository to your system, we need to run the following command in the terminal:

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

This command will add the Docker repository to your system.

Step 4: Add the Docker repository to APT sources

To add the Docker repository to APT sources, we need to run the following command in the terminal:

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

This command will add the Docker repository to APT sources on your system.

Step 5: Install Docker on Ubuntu

Now that we have added the Docker repository to our system, we can proceed to install Docker by running the following command in the terminal:

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

This command will install Docker, the Docker command-line interface, and the containerd.io package on your system.

Step 6: Verify the installation

To verify that Docker has been installed correctly, run the following command in the terminal:

docker run hello-world

This command will run the “hello-world” container, which will print a message confirming that Docker is working correctly.

Note: It is recommended to add your user to the “docker” group to run Docker commands without using “sudo” . You can do this by running the command

sudo usermod -aG docker $USER.

After following these steps, Docker should be installed and running on your Ubuntu system. You can now use Docker to run and manage containerized applications.

The post How To Install Docker On Ubuntu 22.04|20.04|18.04 appeared first on Osgrove.

Ubuntu Server Admin

Recent Posts

Predict, compare, and reduce costs with our S3 cost calculator

Previously I have written about how useful public cloud storage can be when starting a…

16 hours ago

One Thread to Poll Them All: How a Single Pipe Made WaterDrop 50% Faster

This is Part 2 of the "Karafka to Async Journey" series. Part 1 covered WaterDrop's…

19 hours ago

A year of documentation-driven development

For many software teams, documentation is written after features are built and design decisions have…

2 days ago

Announcing FIPS 140-3 for Ubuntu Core22

With the release of the FIPS 140-3 certified cryptographic modules for Ubuntu 22.04 LTS, Canonical…

3 days ago

The foundations of software: open source libraries and their maintainers

Open source libraries are repositories of code that developers can use and, depending on the…

6 days ago

From inspiration to impact: design students from Regent’s University London explore open design for their dissertation projects

Last year, we had the opportunity to speak at Regent’s UX Conference (Regent’s University London’s…

7 days ago