10/23/24Less than 1 minute
Brief
Compose is a tool software come from Docker, which can manage an application from multiple docker containers. You need to define a YAML file docker-compose.yml, to define the relationship among containers. Then, to startup or shutdown with one command.
Download
Official Document
Official Download
Docker Compose
Docker Compose Core Concepts
- One filedocker-compose.yml
- Two elements - service:
- project: a set of container comprise a complete business unit, which are defined in docker-compose.yml
 
Docker Compose Steps
- Write Dockerfile, define kinds of microservices and build correlated images
- Use docker-compose.ymldefine a complete business unit, arrange each container service.
- Execute docker-compose upcommand to startup all the applications.
Most Used Commands for Compose
docker-compose -h 
docker-compose up      # startup all docker-compose service
docker-compose up -d   # startup all docker-compose service and run in the backend
docker-compose down    # shutdown and delete container, network, volume and images.
docker-compose exec {service id in yml}  #docker-compose exec docker-
docker-compose ps      # display all containers under current docker-compose 
docker-compose top     # display all containers process under current docker-compose 
docker-compose logs {service id in yml} # display logs
docker-compose config  # check configuration
docker-compose config -q  # check all the configuration, only display when some errors happened
docker-compose restart # restart service
docker-compose start   # start service
docker-compose stop    # stop service