In this guide, you will learn:
How to Install Docker Compose on Debian 12
- How to Install Docker Compose on Debian 12 from Default Repository
- How to Install Docker Compose on Debian 12 from Docker Compose Executable File
- Bonus Method: How to Install Docker Compose on Debian 12 from Docker Desktop App
How to Use Docker Compose on Debian 12
How to Install Docker Compose on Debian 12
You can install docker compose on Debian 12:
How to Install Docker Compose on Debian 12 from Default Repository
You can install docker compose on Debian 12 from the default system repository using the following steps:
Step 1: Update Debian 12 Repository
Before installing docker compose, update the Debian 12 repository using the below-provided command:
Step 2: Install Docker Compose on Debian 12
After updating the repository, use the below-given command to install docker compose on Debian:
Step 3: Check Docker Compose Version on Debian
To confirm docker compose is installed on Debian 12, you can run the following command. It will provide you with the version that ensures docker compose is successfully installed on your system:
How to Remove Docker Compose from Debian 12
If you have installed docker compose from Debian repository, you can remove it from your system anytime using the following command:
How to Install Docker Compose on Debian 12 from Docker Compose Executable File
The default repository method used for installing docker compose on Debian 12 will not install the latest version of the software. However, you can download the latest version docker compose executable file and perform the required steps to install docker compose on Debian 12. The complete step-by-step instructions to install docker compose on Debian 12 from docker compose executable file are given below:
Step 1: Download Docker Compose Executable File
First, download the latest version of docker compose file from the GitHub release page based on the system you are using.
If you are using Debian 12 amd64 operating system, you can simply run the below-given command in the terminal:
The above command will download the docker compose file on Debian 12.
Step 2: Rename Docker Compose File
Now rename the docker-compose-linux-version file that you downloaded in the early step with docker-compose from the below-given command:
Step 3: Copy the Docker Compose File to Bin Directory
Then copy the docker-compose file to bin directory from the following command:
Step 4: Make the Docker Compose File Executable
After that, make the docker compose file executable on Debian 12 with the chmod command given below:
Step 5: Set Path Variable
You must also set the path variable for docker compose directory so that the system will know the location of the docker-compose file. To set the path variable on Debian 12, open the .bashrc file from the command given below:
Then add the following line inside the .bashrc file:
Note: You can find the location of docker-compose file using the following command:
You must save the .bashrc file using CTRL+X, add Y and press Enter, then use the source command given below to reload the changes to the .bashrc file:
Step 6: Check Docker Version on Debian 12
To confirm the installation and ensure the latest version of docker compose is installed on Debian 12, you can use the following command:
Note: You can remove docker compose on Debian 12 installed from the above method by removing the source directory using the following command:
Bonus Method: How to Install Docker Compose on Debian 12 from Docker Desktop App
Docker Desktop is a GUI based application that allows you to manage docker-related activities on your system. If you want to install the docker and docker compose latest release on Debian 12, you can go for installing Docker Desktop. However, Docker Desktop will not run if you are using Debian as a virtual machine because it doesn’t support nested virtualization.
How to Use Docker Compose on Debian 12
To learn how to use docker compose on Debian 12, you must ensure both docker and docker compose are installed on your system. After that, follow the below-given steps to lean the use of docker compose on Debian 12:
Step 1: Create a Hello World Directory
First, create a hello-world directory on Debian 12 using the following command:
Step 2: Navigate to Hello World Directory
Then use the cd command to open the hello-world directory on the terminal:
Step 3: Create an yml File
You should also create an yml file that you will use later on for configuring the docker application services, this file can be created in Debian 12 using:
Inside this file, add the code given below:
image: hello-world
You can then save the file using CTRL+X, add Y and press Enter to exit:
Step 4: Pull the Docker Image
After creating the image on Debian, you can pull it from the docker hub repository using the following command:
In this way, you can work with docker compose on your Debian system.
Conclusion
Docker Compose is a powerful tool used for managing multiple container applications. You can install docker compose on Debian 12 from the default system repository or through the docker compose executable file. The repository method installs the old version of docker compose while the executable file method will install the latest version of docker compose on Debian 12. The complete process with a step-by-step guide to install docker compose on Debian 12 using both these methods are provided in the above sections of this guide. Follow them and start working with docker and docker compose your Debian system.