Docker Compose is used to run multiple containers as a single service. For example, suppose you had an application which required NGNIX and MySQL, you could create one file which would start both the containers as a service without the need to start each one separately
Docker compose reads configuration data from a YAML file .
The key difference between docker run versus docker-compose is that docker run is entirely command line based, while docker-compose reads configuration data from a YAML file.
The second major difference is that docker run can only start one container at a time, while docker-compose will configure and run multiple.
Docker Compose Installation
First step is to check if Docker is installed or Not . We can check by using the below command. If Docker is not installed, than you need to install it
InstallCompose
Step 1 − Download the necessary files from github using the following command
sudo curl -L "https://github.com/docker/compose/releases/download/1.10.0-rc2/dockercompose-$(uname -s) -$(uname -m)" -o /home/demo/docker-compose
Then, Run the below Command.
sudo curl -L "https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Now, we need to give permissions, for that run the below command
Next, we need to provide execute privileges to the downloaded Docker Compose file, using the following command
chmod +x /usr/local/bin/docker-compose
We can then use the following command to see the compose version.
docker-compose version
YAML: Yet Another/Ain't Mark Up Language
It is basically a key value pair.
vi example1-docker-compose.yaml
No comments:
Post a Comment
Thank you for visiting my blog