Docker Compose学习概览
First: 使用Dockerfile定义你所使用的app环境,这样便于随处重用.
Second: 在 docker-compose.yml 中定义app中的服务,这样这些服务可以在独立的环境中运行.
Last: 运行 docker-compose up ,这样compose就会启动并且运行所有的app.
version: '2' services: web: build: ports: - "5000:5000" volumes: - .:/code - logvolume01: /var/log links: - redis: image: redis volumes: logvolume01: { } |
compose 文档
- Installing Compose
- Getting Started
- Get started with Django
- Get started with Rails
- Get started with WordPress
- Frequently asked questions
- Command line reference
- Compose file reference
compose特色
- Multiple isolated environments on a single host
- Preserve volume data when containers are created
- Only recreate containers that have changed
- Variables and moving a composition between environments
Multiple isolated environments on a single host
默认的项目名称是项目目录名,你可以通过 -p 命令行参数设置一个惯用的项目名称或者 COMPOSE_PROJECT_NAME 环境变量
Only recreate containers that have changed
Variables and moving a composition between environments
Docker Compose is under active development. If you need help, would like to contribute, or simply want to talk about the project with like-minded individuals, we have a number of open channels for communication.
-
To report bugs or file feature requests: please use the issue tracker on Github.
-
To talk about the project with people in real time: please join the
#docker-compose
channel on freenode IRC. -
To contribute code or documentation changes: please submit a pull request on Github.
For more information and resources, please visit the Getting Help project page.