For Linux:
# Create the docker cli plugins directory if it doesn't exist
mkdir -p ~/.docker/cli-plugins/
# Download the latest stable version
curl -SL <https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64> -o ~/.docker/cli-plugins/docker-compose
# Make the binary executable
chmod +x ~/.docker/cli-plugins/docker-compose
# Verify the installation
docker compose version
For macOS:
For Windows:
Alternative methods:
pip install docker-compose
sudo apt update
sudo apt install docker-compose
Note: The recommended way is to install Docker Compose V2 as a Docker CLI plugin (first method shown for Linux). The apt and pip methods might give you older versions.
To verify the installation, run:
docker compose version
Let me explain the three different formats of Docker volume mounting:
hostPath:containerPath[:mode]