UbuntuUbuntu Based

How To Install Docker Compose on Ubuntu 22.04 LTS

Install Docker Compose on Ubuntu 22.04

In this tutorial, we will show you how to install Docker Compose on Ubuntu 22.04 LTS. For those of you who didn’t know, Docker Compose is a powerful tool that allows you to define and manage multi-container Docker applications using a single configuration file. It simplifies the process of setting up and running complex applications that consist of multiple containers, each with its own dependencies and configurations.

With Docker Compose, you can define the services that make up your application, their dependencies, network configurations, volumes, and other settings in a single YAML file. This file serves as a blueprint for your application, making it easy to spin up or tear down the entire application stack with a single command.

One of the key benefits of using Docker Compose is its ability to streamline the development and deployment processes. By defining your application’s components and their relationships in a single file, you can ensure consistent and reproducible environments across different stages of the development lifecycle, from local development to production deployment.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Docker Compose on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.


  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Docker Compose on Ubuntu 22.04 LTS Jammy Jellyfish

Step 1. Before installing any new software, it’s always a good practice to update the package database on your Ubuntu system. Open a terminal and run the following command:

sudo apt update
sudo apt upgrade
sudo apt install ca-certificates curl gnupg lsb-release

Step 2. Installing Docker.

By default, Docker is not available on Ubuntu 22.04 base repository. Now run the following command below to add the Docker repository to the system:

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

Next, import the GPG key to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

After the repository is enabled, now install the latest version of the Docker package using the below command:

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

You can verify that Docker is installed and about the current version:

docker -v

After successfully installed, enable Docker (to start automatically upon system boot), start, and verify the status using the commands below:

sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl status docker

For additional resources on installing and managing Docker, read the post below:

Step 3. Install Docker Compose on Ubuntu 22.04.

Now run the following command below to download the stable version of Docker Compose from the GitHub page:

mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.27.0/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose

Once the file is downloaded, make it executable by this command:

chmod +x ~/.docker/cli-plugins/docker-compose

To ensure that Docker Compose has been installed correctly, you can check its version by running the following command:

docker compose version


Docker Compose version v2.27.0

Step 4. Create a Sample Docker Compose File.

Let’s create a directory that holds our Compose file:

mkdir sample-test
cd sample-test

For testing purposes, I will create a sample test docker-compose YAML file using a nano text editor:

nano docker-compose.yaml

Add the following file:

version: '1.1'

Save and close the file, then use the Docker Compose command to execute the code given in the file, which simply says to pull the image hello-world and create a container with that:

sudo docker-composer up

Your environment is now up and running in the background. To verify that the container is active, you can run:

docker compose ps

Congratulations! You have successfully installed Docker Compose. Thanks for using this tutorial for installing the Docker Compose on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official Docker website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button