How to Install Docker on Ubuntu Server 22.04 LTS ( Made Easy / One-Click )

Amin
mabttech
Published in
2 min readJun 25, 2024

Docker is a powerful platform for developing, shipping, and running applications inside containers. This flexibility allows you to manage your applications and services effortlessly. Here’s a comprehensive guide on installing Docker Engine on Ubuntu Server 22.04 LTS. This also cloud work on any ubuntu server version including 20.04 LTS…etc

Available Installation Methods

There are several methods to install Docker, each suited for different needs:

  1. Docker Desktop for Linux: The simplest way to get Docker on Linux, ideal for beginners.
  2. Docker’s APT Repository: Recommended for most users for ease of installation and updates.
  3. Manual Installation: For those who prefer manual installation and updates.
  4. Convenience Script: Best suited for testing and development environments, not for production.

Installing Docker Using the APT Repository

Before installing Docker Engine for the first time on a new host, you must set up the Docker repository. This allows you to install and update Docker easily from the repository.

Step 1: Set Up Docker’s APT Repository

First, add Docker’s official GPG key and set up the repository:

# Update the package index and install packages to allow apt to use a repository over HTTPS

sudo apt-get update

sudo apt-get install ca-certificates curl

sudo install -m 0755 -d /etc/apt/keyrings
# Add Docker's official GPG key

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc


sudo chmod a+r /etc/apt/keyrings/docker.asc
# Set up the stable repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Note: If you’re using a derivative of Ubuntu, such as Linux Mint, replace $VERSION_CODENAME with $UBUNTU_CODENAME in the script above.

Step 2: Install Docker Engine

Now, install the Docker packages:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

This command installs Docker Engine, CLI tools, and necessary plugins.

Step 3: Verify the Installation

Ensure that Docker Engine is installed correctly by running the hello-world image:

sudo docker run hello-world

This command downloads a test image and runs it in a container, which prints a confirmation message upon successful execution.

Congratulations!

You have successfully installed Docker Engine on Ubuntu Server 22.04 LTS. You can now begin containerizing your applications and take advantage of Docker’s robust platform for your development and production needs.

More :

--

--