Ubuntu 22.04 is the current LTS version of the popular Linux dis­tri­bu­tion and can be used for many ap­plic­a­tions. In­stalling the vir­tu­al­isa­tion software Docker is also simple on Ubuntu 22.04 and can be done in just a few steps.

What are the system re­quire­ments?

To suc­cess­fully install Docker, your Linux system running Ubuntu 22.04 needs to meet a few re­quire­ments. Since Docker is an off-the-shelf software that is es­pe­cially popular in software de­vel­op­ment, the re­quire­ments aren’t very high:

  • 64-bit kernel and CPU support for vir­tu­al­isa­tion
  • KVM vir­tu­al­isa­tion support
  • QEMU version 5.2 or newer
  • Gnome, KDE or MATE desktop en­vir­on­ment
  • At least 4 GB RAM (es­pe­cially important if you want to install Docker on a Linux virtual machine)

What types of servers can you use for a Linux server?

If you want to install Docker on Ubuntu 22.04, you don’t have to use your local computer or a virtual machine. You can also set up a Docker en­vir­on­ment on your very own Linux server. Here, you need to make a choice between different server types.

A basic dis­tinc­tion is made between cloud-based and dedicated server solutions. Cloud servers and virtual private servers (vServer) are both cloud based. The former is billed by the minute and according to usage. With a vServer, you can choose between different monthly packages. Both server types offer highly scalable resources, allowing for flexible ad­apt­ab­il­ity to changing resource needs.

A dedicated server is also billed by the minute but isn’t a cloud-based system. It provides dedicated en­ter­prise hardware that meets the highest system re­quire­ments.

No matter what type of server you choose, you get to decide which operating system you use. With IONOS, you have the choice between Windows and different Linux dis­tri­bu­tions. Ad­di­tion­ally, each server comes with excellent avail­ab­il­ity and a broadband con­nec­tion of up to 400 Mbps.

Which IONOS package is right for you?

In order to determine which server is the right one for you, you need to think about what the server will be used for. Below are three common usage scenarios for a Linux server with Docker. Taking a look at these scenarios can help you to figure out which option will be best for you:

Scenario Server re­com­mend­a­tion
A server to implement and develop your own projects. Cloud Server XL
Deploy various ap­plic­a­tions to clients using your Linux server. VPS Linux L
A server for deploying virtual en­vir­on­ments. VPS Linux XL
Tip

If you’re not satisfied with your Ubuntu version, you can install Docker on Ubuntu 20.04. The vir­tu­al­isa­tion software is com­pat­ible with different Linux dis­tri­bu­tions.

How to install Docker on Ubuntu 22.04: a step-by-step tutorial

You can install Docker on Ubuntu 22.04 directly in the terminal. As long as you have basic knowledge of writing terminal commands, you shouldn’t encounter any problems.

Step 1: prepare system

First, make sure that all packages and your system are up to date. You can do this by using the following two commands:

sudo apt-get update
sudo apt-get upgrade
bash

Step 2: remove Docker residue

If you’ve pre­vi­ously used beta versions of Docker or installed previews of the vir­tu­al­isa­tion software, you need to remove them before in­stalling Docker. Not removing them can cause errors.

sudo apt remove docker-desktop
rm -r $HOME/.docker/desktop
sudo rm /usr/local/bin/com.docker.cli
sudo apt purge docker-desktop
bash

Step 3: download Docker re­pos­it­ory

Docker uses an in­stall­a­tion re­pos­it­ory, so you need to store it in your system. To work with the re­pos­it­ory, install the following packages:

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
bash

You can then add Docker’s GPG key to your system:

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
bash

Set up the Docker re­pos­it­ory with the following command:

echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
bash

Step 4: install Docker Engine

You can download Docker Engine directly in the terminal in Ubuntu 22.04. The commands you need to do this differ depending on whether you need a specific Docker version or the current one.

To download a specific version of Docker, use the following command to list all available versions:

apt-cache madison docker-ce | awk '{ print $3 }'
bash

Pick a version from the list and enter the version as the version string. Then install it as follows:

VERSION_STRING=5:20.10.13~3-0~ubuntu-jammy
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-compose-plugin
bash

In­stalling the current Docker version is even easier:

apt-cache madison docker-ce | awk '{ print $3 }'
bash

Step 5: check in­stall­a­tion

After the in­stall­a­tion, you can use the following command to start a ‘Hello World’ Docker container and check if the in­stall­a­tion was suc­cess­ful:

sudo docker run hello-world
bash

If everything worked correctly, you should see the following output:

Image: Terminal output after running ‘docker run hello-world’.
After running ‘docker run hello-world’, you should get a brief ex­plan­a­tion of how Docker works.

Step 6 (Optional): run Docker as a non-root user

To run Docker, you need root priv­ileges. That’s why you need to start all your commands with ‘sudo’. If you want to run Docker as a user without root priv­ileges, you need to create a Docker group.

Step 6.1: create a group named ‘Docker’

Create a group named ‘docker’ that you can assign users to with the following command:

sudo groupadd docker
bash

Step 6.2: add users

With a simple command, you can add users to the Docker group you created, allowing them to run Docker without root priv­ileges:

sudo usermod -aG docker $USER
bash

Remember that $USER is just a place­hold­er and must be replaced with a user’s name. For the changes to take effect, you need to log out and then log back in. After you have done this, you can access Docker without using sudo.

Tip

Using Windows, too? We have further manuals for in­stalling Docker on Windows 10 and Docker on Windows 11.

Go to Main Menu