Docker Compose is an Effective tool for running Multiple containers by passing multiple parameters in a YAML format/file and can simply be run as docker-compose up and docker-compose down.
Ideally, when you run a docker container out of the docker image it can be helpful for running a single container with fewer parameters, but Just assume if you need to run multiple containers with passing several parameters, like passing Environmental Variables, Volumes, Networks, linking containers, etc then docker compose is very helpful.
It Creates the entire environment based on the YAML file you have created and also it’s easy to delete exactly the same thing what you have created from docker compose itself.
So let’s see the Installation procedure of Docker Compose. make Sure your Server has Docker Installed.
sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
Above Command Downloads, the docker compose release from the official docker GitHub repository. Make Sure to check the latest release (Version) when Installing from here.
Command Downloads the binary files identifying your Operating System and the Architecture and puts it to the defined location i.e, /usr/local/bin
To Make this executable make sure to give execute permission, use below command.
ubuntu@devopsage:~$ sudo chmod +x /usr/local/bin/docker-compose
Once the docker compose is installed and setup, verify it by checking its version using the below command.
ubuntu@devopsage:~$ docker-compose --version docker-compose version 1.22.0, build f46880fe
That’s It for this particular blog. Next blog will be on, working with docker compose and useful commands.
You May Also need to Look At,