【问题标题】:docker-engine to docker-compose to docker compose file relationshipdocker-engine 到 docker-compose 到 docker compose 文件关系
【发布时间】:2019-03-07 20:26:09
【问题描述】:

大家:

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

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/

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

-纳拉哈里

【问题讨论】:

    标签: docker docker-compose docker-engine


    【解决方案1】:

    你的 docker-compose 已经很老了,只支持 docker-compose.yml 文件的 2.1 版本。

    Version 2.2 受 1.13.0 或更高版本支持。

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

    在 .yml 参考指南中有一个包含兼容性说明的表格。

    【讨论】:

    • 嗯。但是 2.1 的版本指令适用于 docker-compose 1.9。
    【解决方案2】:

    1.9.0 版的 docker-compose 仅​​支持 2.1 版的 compose 文件规范。

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

    【讨论】:

      【解决方案3】:

      Docker Compose release 1.9.0...

      引入了 docker-compose.yml 规范的 2.1 版。这个 版本需要与 Docker Engine 1.12 或更高版本一起使用。

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-14
        • 1970-01-01
        • 2021-09-14
        • 2021-08-21
        • 1970-01-01
        相关资源
        最近更新 更多