Install and use Docker Compose Ubuntu 22.04 2 very simple steps..
Table of Contents
Introduce
Docker compose is a tool used to define and run multi-containers for Docker applications. With compose you use the YAML file to configure the services for your application. Then use the command to create and run from those configs. Using is also quite simple according to the steps:
- Declare app’s environment in Dockerfile.
- Declare the services needed to run the application in the docker-compose.yml file.
- Run docker-compose up to start and run the app.
In this tutorial, I will show you how to install Docker compose and create a new application using Docker compose on Ubuntu 22.04.
DNecessary conditions before installation Docker compose
- You must have SSH access
- The server must have Docker pre-installed.
Installation Instructions
Step 1: Install Docker Compose
sudo curl -L https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
- The file permissions have just re-downloaded
sudo chmod +x /usr/local/bin/docker-compose
- Test after installation

So Docker Compose has been successfully installed and you can start running containers.
Step 2: Using Docker Compose
Docker Compose allows you to use YAML files to define multiple container applications. With the YAML file, you can run, build and configure all the containers.
- Create a project folder and move into that project folder, for example:
mkdir docker-project cd docker-project
- Create a YAML file, for the basic example I will create a yaml file for hello world.
sudo nano docker-compose.yml
Add below content to the created file
version: '3.9'
services:
hello-world:
image:
hello-world:latest
You can now execute the following command to pull the hello word image from Docker Hub.
And here is the result after running

And so the hello-world image is taken from Docker Hub and docker-compose creates a container, attaches it and runs the program.
- To view all existing containers, use the command:

So, in this article, I have shown you how to install and use it Docker compose on Ubuntu 22.04 is extremely simple. Hope this article is useful to you, and good luck to you.
You can refer to other user guides at the link below:
If you need assistance, you can contact support in the ways below: