手册
官方介绍:定义、运行多个容器
:yaml file配置文件
:single command 命令有哪些?
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. To learn more about all the features of Compose, see the list of features.
所有环境都可以使用 compose
Compose works in all environments: production, staging, development, testing, as well as CI workflows. You can learn more about each case in Common Use Cases.
三步骤:
Using Compose is basically a three-step process:
1.Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
使用docker file构建应用程序环境,任何环境都可以复制使用
2.Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
services什么是服务
docker-compose.yml 文件怎么写
3.Run docker-compose up and Compose starts and runs your entire app.
启动项目
个人理解:
compose是个工具,需要安装
docker file 可以在任何地方运行
compose
version: '2.0'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
- logvolume01:/var/log
links:
- redis
redis:
image: redis
volumes:
logvolume01: {}
compose:重要的概念
服务services , 容器、应用 (web 、MySQL 、)
项目project , 一组关联的容器。(博客、数据库等)