How to Install Docker Compose on Ubuntu 21.04 and 21.10
This short article shows you how to set up Docker Compose on Ubuntu 21.04 or 21.10. Before getting started, make sure you have Docker Engine installed (note that Docker Compose doesn’t come with Docker Engine on Linux). If you don’t, see this article first.
Installing Docker Compose
1. Create a new directory:
mkdir -p /usr/local/lib/docker/cli-plugins
2. Download the docker-compose binary file from GitHub with curl:
curl -SL https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
At the time of writing, 2.1.1 is the latest stable version of Docker Compose. You can replace it with another version number. Check the release page to see more available versions.
After running the preceding command a few seconds, you will see this:
3. Make the downloaded binary executable:
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
4. Verify that Docker Compose was successfully installed by running:
docker compose version
You will see something similar to my screenshot below:
Note that the docker compose command (without the dash symbol) has been added recently and only works with Docker Compose 2.0.0 or newer.
You should no longer use this old-fashioned command:
Congratulations. You now get Docker Compose installed and ready to work. If you’d like to explore more new and exciting things about Docker, take a look at the following articles:
- Using Docker Compose to speed up WordPress development
- Using Docker Compose with Node.js and MongoDB
- Docker: How to Retag an Image
- Start, Pause, Restart, Stop, and Delete a Docker Container
- How to Get the Size of a Docker Image
You can also check out our Docker topic page for the latest tutorials, examples, tips, and tricks.