Docker Compose概述
**DockerCompose** | **前身 Fig** |
docker-compose.yml
大概是这个样子的:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
links:
- redis
redis:
image: redis
Compose包含管理应用整个生命周期的命令:
- 启动、停止和重建服务
- 查看运行的服务状态
- 对运行的服务的日志输出生成数据流
- 对一个服务运行一次性命令
Docker Compose安装
curl -L https://github.com/docker/compose/releases/download/VERSION_NUM/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
Docker Compose命令
更新整个应用
mryqu$ docker-compose stop # stop the containers
mryqu$ docker-compose pull # download updated images
mryqu# docker-compose up -d # creates new containers and starts them
更新单个服务
mryqu$ docker-compose stop foo # stop the foo service
mryqu$ docker-compose pull foo # download foo service
mryqu$ docker-compose up -d foo # start the new foo service