Docker compose : Steps to install
Intro
To install Docker Compose, you can follow these steps. Docker Compose typically comes bundled with Docker Desktop on Windows and macOS. If you are using Linux, you can install it separately. Here are the installation instructions for both Windows/macOS and Linux:
For Windows and macOS:
1. Install Docker Desktop:
- If you haven’t already, you need to install Docker Desktop, which includes Docker Compose. You can download Docker Desktop from the [Docker website](https://www.docker.com/products/docker-desktop).
2. Enable Docker Compose:
Once Docker Desktop is installed, it should include Docker Compose. You can verify this by opening a command prompt or terminal and running the following command to check the Docker Compose version:
docker compose version
If the command returns the Docker Compose version, then Docker Compose is installed and ready to use.
For Linux:
1. What you need to know
On Linux, you can either install Docker desktop which has a bundle Docker Compose, or install Docker engine and then add docker compose plugin. You can follow these steps to install Docker Compose on Linux if you you chose the second option
2. Install Docker Compose:
- From repository : In this case you install from your distro repository
sudo apt-get update # apt-get if you use ubuntu or debian. yum for rpm based distros
sudo apt-get install docker-compose-plugin
- Manually: You download the executable and you run it.
# To download
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
# make the script executable
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose # you might need to use sudo
# using sudo the installation will work for all users, otherwise only for the current user
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
- Standalone installation: There is a third way to do this as explained here, but personally i dont recommend it.
2. Verify Installation:
Verify that Docker Compose is installed correctly by running the following command to check the version:
docker compose version
You should see the installed version of Docker Compose.
That’s it! Docker Compose is now installed on your Linux system, and you can use it to define and manage multi-container applications.
Remember that you might need to run Docker Compose commands with sudo or as a privileged user. To avoid using sudo, consider adding your user to the “docker” group, but be cautious, as it gives your user elevated privileges with Docker. Check the official documentation
Now Have Fun !!!
At this point you are ready to use , docker compose and get a lot of fun with docker !!!!
Extro
This conclude our docker compose installation. I Hope that now you feel more confident to tackle the Docker world, after reading this article. In that case , feel free to like it or add some comments below to improve it. Thank you !!