Learning Center
Docker

How to Install Docker on Ubuntu 22.04

21 Jan 2026
Hostman Team
Hostman Team

Docker is a free, open-source tool for application containerization. Containers are isolated environments similar to virtual machines (VMs), but they are more lightweight and portable across platforms, requiring fewer system resources. Docker uses OS-level virtualization, leveraging features built into the Linux kernel.

Docker on Ubuntu working scheme

Apps order after installing Docker on Ubuntu

Although it applies to other Ubuntu versions as well, this tutorial explains how to install Docker on Ubuntu 22.04. We'll also download Docker Compose, which is a necessary tool for effectively managing several containers.

For this guide, we will use a Hostman cloud server.

System Requirements
Copy link

According to Docker's documentation, the following 64-bit Ubuntu versions are supported:

  • Ubuntu Oracular 24.10

  • Ubuntu Noble 24.04 (LTS)

  • Ubuntu Jammy 22.04 (LTS)

  • Ubuntu Focal 20.04 (LTS)

Docker works on most popular architectures. The resource requirements for your device will depend on your intended use and how comfortably you want to work with Docker. The scale of applications you plan to deploy in containers will largely dictate the system needs. Some sources recommend a minimum of 2 GB of RAM.

Additionally, a stable internet connection is required.

Installing Docker on Ubuntu 22.04
Copy link

Installing Docker on Ubuntu 22.04 involves executing a series of terminal commands. Below is a step-by-step guide with explanations. The steps are also applicable to server versions of Ubuntu.

1. Update Package Indexes

The default repository may not always contain the latest software releases. Therefore, we will download Docker from its official repository to ensure the latest version. First, update the package indexes:

sudo apt update

2. Install Additional Packages

To install Docker, you’ll need to download four additional packages:

  • curl: Required for interacting with web resources.
  • software-properties-common: Enables software management via scripts.
  • ca-certificates: Contains information about certification authorities.
  • apt-transport-https: Necessary for data transfer over the HTTPS protocol.

Download these packages with the following command:

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

The -y flag automatically answers "Yes" to all terminal prompts.

3. Import the GPG Key

Software signatures must be verified using the GPG key. Docker's repository must be added to the local list. Use the command to import the GPG key:

wget -O- https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/docker.gpg > /dev/null

During the import process, the terminal may display a warning before confirming the successful execution of the command.

4. Add Docker Repository

Add the repository for your version of Ubuntu, named "Jammy." For other versions, use their respective code names listed in the "System Requirements" section. Run the following command:

echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

During execution, the terminal will prompt you to confirm the operation. Press Enter.

5. Update Package Indexes Again

After making these changes, update the package indexes once more using the familiar command:

sudo apt update

6. Verify the Repository

Ensure that the installation will proceed from the correct repository by running the following command:

apt-cache policy docker-ce

Output example:

Image2

Depending on the most recent Docker releases, the result could change. Verifying that the installation will be carried out from Docker's official repository is crucial.

7. Installing Docker

After configuring the repositories, proceed with the Docker installation:

sudo apt install docker-ce -y

The installation process will begin immediately. To confirm a successful installation, check Docker's status in the system:

sudo systemctl status docker

Output example:

Image1

The output should indicate that the Docker service is active and running.

And if you’re looking for a reliable, high-performance, and budget-friendly solution for your workflows, Hostman has you covered with Linux VPS Hosting options, including Debian VPS, Ubuntu VPS, and VPS CentOS.

Installing Docker Compose
Copy link

Docker Compose is a Docker tool designed for managing multiple containers. It is commonly used in projects where many containers must work together as a unified system. Managing this process manually can be challenging. Instead, you describe the entire configuration in a single YAML file containing the settings and configurations for all containers and their applications.

There are several ways to install Docker Compose. If you need the latest version, make sure to use manual installation and installation via the Git version control system.

Installation via apt-get
Copy link

If having the latest version is not critical for you, Docker Compose can be installed directly from the Ubuntu repository. Run the following command:

sudo apt-get install docker-compose

Installing via Git
Copy link

First, install Git:

sudo apt-get install git

Verify the installation by checking the Git version:

git --version

The output should show the Git version.

Next, clone the Docker Compose repository. Navigate to the Docker Compose GitHub page and copy the repository URL.

0567a75f 7e83 4c5b Af5b 4c1a21a9f5fc

Run the following command to clone the repository:

git clone https://github.com/docker/compose.git

The cloning process will begin, and the repository will be downloaded from GitHub.

Manual Installation
Copy link

Go to the Docker Compose GitHub repository and locate the latest release version under the Latest tag.

At the time of writing, the Latest version of Docker Compose is v2.31.0. Let's download it:

sudo curl -L "https://github.com/docker/compose/releases/download/v2.31.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

In this command, the parameters $(uname -s) and $(uname -m) automatically account for the system characteristics and architecture. After the download finishes, change the file's permissions:

sudo chmod +x /usr/local/bin/docker-compose

Right order of your infrastructure after installation of Docker on Ubuntu

Right order of your infrastructure after installation of Docker on Ubuntu

Conclusion
Copy link

In this guide, we covered the installation of Docker on Ubuntu 22.04, along with several ways to install Docker Compose. You can order a cloud server at Hostman for your experiments and practice.

Frequently Asked Questions (FAQ)
Copy link

How to install Docker in terminal? 
Copy link

The easiest way to install the standard Ubuntu version is to run: sudo apt updatesudo apt install docker.io Note: For the absolute latest version, you should set up the official Docker repository and install docker-ce instead.

How do I run Docker without using sudo? 
Copy link

By default, Docker requires root privileges. To run it as a standard user, add your user to the "docker" group:

  1. sudo usermod -aG docker $USER

  2. Log out and log back in for the changes to take effect.

How do I check if Docker is installed and running? 
Copy link

Run the "hello-world" container to verify the entire toolchain: sudo docker run hello-world If successful, it will download a test image and print a welcome message.

How do I install Docker Compose on Ubuntu 22.04? 
Copy link

In modern versions, Docker Compose is included as a plugin. Install it via: sudo apt install docker-compose-plugin You can then run it using docker compose (note the space, no hyphen).

What is the difference between docker.io and docker-ce?
Copy link

  • docker.io: The Docker package maintained by the Ubuntu team. It is stable but may be slightly older.

  • docker-ce: The "Community Edition" package maintained directly by Docker, Inc. It contains the latest features and patches.

How do I uninstall Docker? 
Copy link

To remove the software but keep your containers/images: sudo apt remove docker docker.io containerd runc To remove everything including images and volumes, delete the directory: sudo rm -rf /var/lib/docker.