简介


可以使用来轻松和高效管理容器,定义运行和多个容器

官方介绍:
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 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:

Define your app’s environment with a Dockerfile so it can be reproduced anywhere.

Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.

Run docker-compose up and Compose starts and runs your entire app.

作用:批量容器编排

Compose是一个开源的项目,需要安装

Dockerfile 让程序在任何地方运行 web服务 redis mysql nginx ..多个容器

Compose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
version: "3.8"
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
- logvolume01:/var/log
links:
- redis
redis:
image: redis
volumes:
logvolume01: {}

Compose:主要概念

  1. 服务service 容器 应用 (web redis mysql)
  2. 项目 project 一组关联的容器 博客 web mysql