Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to describe the services, networks, and volumes of your application in a YAML file and then run them with a single command. In this tutorial, we’ll show you how to install Docker Compose on Ubuntu 22.
Before you begin, you should have a fresh Ubuntu 22 server instance with a non-root user with sudo privileges configured.
Step 1: Update the package list and install the required dependencies
The first step is to update the package list on your Ubuntu 22 server by running the following command:
sudo apt-get update
This will ensure that your server has the latest information about available packages.
Next, you need to install some required dependencies for Docker and Docker Compose. You can do this by running the following command:
sudo apt-get install -y curl jq
This command installs
curl, a tool for transferring data from a server, and
jq, a tool for processing JSON data. These dependencies are required for installing Docker and Docker Compose.
Step 2: Install Docker Compose
Once the required dependencies are installed, you can install Docker Compose on your Ubuntu 22 server. You can do this by running the following commands:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.17.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
The first command downloads the latest stable release of Docker Compose from the official Docker Compose repository and saves it to the
/usr/local/bin/docker-compose directory on your Ubuntu system. This allows you to use the
docker-compose command to manage multi-container Docker applications.
The second command sets the executable permission on the Docker Compose binary.
After Docker Compose is installed, you can verify that it is running correctly by running the following command:
This command should output the version of Docker Compose that you just installed.
Docker Compose version v2.17.3