xxxxxxxxxx
Compose is a tool for defining and running multi-container Docker applications.
With Compose, you use a YAML file to configure your application’s services.
Then, with a single command, you create and start all the services from your configuration.
Compose works in all environments:
production, staging, development, testing, as well as CI workflows.
It also has commands for managing the whole lifecycle of your application:
Start, stop, and rebuild services
View the status of running services
Stream the log output of running services
Run a one-off command on a service
xxxxxxxxxx
version: '3'
services:
master:
container_name: master
image: redis
ports:
- 6379:6379
task-scheduler:
build: ./task-scheduler
image: vinsdocker/task-scheduler
ports:
- 8080:8080
task-executor:
build: ./task-executor
image: vinsdocker/task-executor
redis-commander:
container_name: redis-commander
hostname: redis-commander
image: rediscommander/redis-commander:latest
restart: always
environment:
- REDIS_HOSTS=master:master
ports:
- 8081:8081
xxxxxxxxxx
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
install docker-compose
xxxxxxxxxx
sudo curl -L https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod 755 /usr/local/bin/docker-compose