In the video Docker Compose v2: What’s New in 2021: DevOps and Docker Live Show (Ep 126) Bret Fisher introduces compose v2.
compose is an instrument for running multiple docker containers on your local machine. I use it often to spin up a database container and a separate application container.
compose v2, a plugin for docker, is written from the ground up in Go and integrates better with existing tools.
The CLI is a drop-in replacement for the previous Python program docker-compose. The Python version is much slower than the new Go version.
If you want to use compose v2 on your Linux machine, you have to install it manually.
Install Compose V2 on Linux
You can now find the installation instructions on the official website.
Find the latest release with the v2
tag. Currently, that’s v2.0.1
.
(I’m using amd64, if you’re using the new Mac M1, you’ll need to find the release for the arm architecture.)
Now type the following commands into your terminal):
# create the docker plugins directory if it doesn't exist yet
mkdir -p ~/.docker/cli-plugins
# download the CLI into the plugins directory
curl -sSL https://github.com/docker/compose/releases/download/v2.0.1/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
# make the CLI executable
chmod +x ~/.docker/cli-plugins/docker-compose
The tool should work:
docker compose version
> Docker Compose version 2.0.1
Learn more about compose v2 in this video: