Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.24 KB

docker_compose.md

File metadata and controls

50 lines (33 loc) · 1.24 KB

DOCKER COMPOSE

What is docker compose?

  1. Tool for defining and running, multicontainer docker applications.

  2. use yaml file to configure application services. (docker-compose.yml)

  3. can start all the services with a single command, can stop all the services with a single command.

  4. can scale up selected services, as and when required.

docker-compose --version
docker-compose version

Usage - TO check if docker compose is installed or not.

  1. Create a file name "docker-compose.yml".

Do bash docker-compose config -d to check the validity of the docker-compose file.

bash docker-compose up -d Usage - Compose to create container and applications.

Note (- -d, --detach) Detached mode: Run containers in the background, print new container names. Pros - so that you have the terminal for writing other commands.

To check the running containers do - docker ps now.

Bring down application by command.

bash docker-compose down Usage - Will stop everything.

TIPS

  1. How to scale some particular services. bash docker-compose -d --scale database=4

Usage - will scale the database (i.e) redis service. This will work even if the containers are already running.