CodeGym /Courses /Docker SELF /Installing Docker Compose

Installing Docker Compose

Docker SELF
Level 15 , Lesson 1
Available

2.1 Docker Compose on Windows

Docker Compose is a tool for defining and running multi-container Docker applications. Installing Docker Compose depends on the operating system you are using. In this lecture, we'll go through the steps for installing Docker Compose on different operating systems: Linux, macOS, and Windows.

Installing Docker Compose on Windows

Step 1: Install Docker Desktop

On Windows, Docker Compose is also installed alongside Docker Desktop. So ideally, it's already installed. If for some reason you're reading this lecture without having Docker installed, go download Docker Desktop from the official Docker website and install it.

Step 2: Launch Docker Desktop

Launch Docker Desktop from the "Start" menu. After installing and starting Docker Desktop, Docker Compose will be available from the command line.

Step 3: Verify the Installation

Open the Command Prompt or PowerShell and check that Docker Compose is installed and works correctly.

Terminal


docker compose --version

Note! Other command variants:

Terminal


docker-compose --version
docker compose version

You should see the version information for Docker Compose.

2.2 Docker Compose on macOS

Installing Docker Compose on macOS

Step 1: Install Docker Desktop

On macOS, Docker Compose is installed together with Docker Desktop. So ideally it’s already installed. If for some reason you are reading this lecture without having Docker installed, go ahead and download Docker Desktop from Docker’s official website and install it.

Step 2: Launch Docker Desktop

Launch Docker Desktop from your applications. After that, Docker Compose will be available from the command line.

Step 3: Verify Installation

Make sure Docker Compose is installed and working correctly.

Terminal


docker compose --version 

You should see the version information of Docker Compose.

Caution! Alternative commands:

Terminal


docker-compose --version
docker compose version

2.3 Docker Compose on Linux

Installing Docker Compose on Linux

Step 1: Install Docker

Before installing Docker Compose, make sure Docker is already installed on your system. If Docker is not installed, run the following commands:

Terminal


sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce 

Step 2: (Optional) Configure Docker to run without sudo

To avoid using sudo for every Docker command, add the current user to the Docker group:

Terminal


sudo usermod -aG docker $USER

Step 3: Install Docker Compose

Just run the command

Terminal


sudo apt-get install docker-compose-plugin

Step 4: Verify Installation

Make sure Docker Compose is installed and functioning correctly.

Terminal


docker compose --version

You should see something like:

Terminal

        
Docker Compose version v2.12.2
3
Task
Docker SELF, level 15, lesson 1
Locked
Installing Docker and Docker Compose on Linux
Installing Docker and Docker Compose on Linux
3
Task
Docker SELF, level 15, lesson 1
Locked
Checking Docker Compose installation on Windows
Checking Docker Compose installation on Windows
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION