Docker Compose 1.2.0 RC3 发布

jopen 9年前

Docker Compose 1.2.0 RC3 发布,测试此版本请使用:

curl -L https://github.com/docker/compose/releases/download/1.2.0rc3/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose  chmod +x /usr/local/bin/docker-compose

此版本相比 RC1 和 RC2 修复的 bug 如下:

  • When copying a service's configuration with extends, image and build could come into conflict, resulting in an error, as it makes no sense to have both defined. Each now overwrites the other: if a service with image defined is extended and build is added, the image entry will be removed.

  • When copying a service's configuration with extends, if both services defined a multi-value option such as ports or dns, the original value would be completely discarded. They are now concatenated instead.

  • When a relative path is supplied to build, it is treated as relative to the directory of the configuration file, not the directory that docker-compose is being run in. In the majority of cases, those are the same, but if you use the -f|--file argument to specify a configuration file in another directory, this is a breaking change.

更多改进内容请看发行说明

此版本现已提供下载:

Docker Compose 是 Docker 编排服务的一部分,Machine 可以让用户在其它平台快速安装Docker,Swarm 可以让 Docker 容器在集群中高效运转,而 Compose 可以让用户在集群中部署分布式应用。简单的说,Docker Compose 属于一个“应用层”的服务,用户可以定义哪个容器组运行哪个应用,它支持动态改变应用,并在需要时扩展。

Docker Compose 1.2.0 RC3 发布

使用Compose的第一步是使用YAML文件来定义容器应用的状态:

containers:

web:

 build: .

 command: python app.py

 ports:

 - "5000:5000"

 volumes:

 - .:/code

 links:

 - redis

 environment:

 - PYTHONUNBUFFERED=1

redis:

 image: redis:latest

 command: redis-server --appendonly yes


上面的YAML文件定义了两个容器应用,第一个容器运行Python应用,并通过当前目录的Dockerfile文件构建。第二个容器是从Docker Hub注册中心的Redis官方仓库中构建。links指令用来定义依赖,意思是Python应用依赖于Redis应用。

定义完成后,通过下面的命令来启动应用:

% docker up

简单吧?通过YAML文件定义的容器应用已经成功启动起来,启动过程会按照YAML的配置严格运行。Python容器通过Dockerfile自动构建, 同时从注册中心拉取Redis容器构建。 links指令关注的是Python和Redis容器之间的依赖关系,Redis容器是最先开始构建,紧随其后的是Python容器。

介绍内容来自  DockerOne