docker-engine 到 docker-compose 到 docker compose 文件关系

docker-engine to docker-compose to docker compose file relationship

朋友们:

提前感谢您的时间和关注。

docker-compose.yml 文件和 docker-compose cli 可执行文件之间的关系是什么?

这是我的例子。

$>docker-compose version

docker-compose version 1.9.0, build 2585387
docker-py version: 1.10.6
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1t  3 May 2016
$> docker version
Client:
 Version:      17.04.0-ce
 API version:  1.28
 Go version:   go1.7.5
 Git commit:   78d1802
 Built:        Tue May 30 18:21:18 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.04.0-ce
 API version:  1.28 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   78d1802
 Built:        Tue May 30 18:21:18 2017
 OS/Arch:      linux/amd64
 Experimental: false

现在 docker-compose.yml 文件

version: "2.2"
services:
  database:
    image: "${DOCKER_REPO_NAME}.......

根据 https://docs.docker.com/compose/compose-file 上的文档,如果 docker-engine 版本是 17.04,它应该支持 docker-compose 文件版本 指令 3.2

但是我看到了这个。错误

***** 错误如下******

$>docker-compose ${NO_ANSI} config -q


ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

所以问题是我做错了什么?

-Narahari

您的 docker-compose 很旧,最多只支持 docker-compose.yml 文件的 2.1 版。

Version 2.2 1.13.0 或更高版本支持。

您可以更新 docker-compose(推荐)或将 .yml 降级为 v1 或 v2.1 兼容。

在 .yml 参考指南中有一个 table 和兼容性说明。

Docker Compose release 1.9.0...

Introduced version 2.1 of the docker-compose.yml specification. This version requires to be used with Docker Engine 1.12 or above.

看起来您至少需要 Docker Compose 1.13.0 才能使用带有 version: "2.2" 的撰写文件。 (不过,除了个人 GitHub 发布页面外,我没有在其他任何地方清楚地看到这一点。)

docker-compose 版本 1.9.0 最多只支持 compose 文件规范的版本 2.1。

https://docs.docker.com/release-notes/docker-compose/#190-2016-11-16