docker-compose中的版本不受支持

wuz*_*com 5 docker docker-compose

我尝试安装这个 docker-compose配置.正如您所看到的,它有版本3.当我运行它时docker-compose build --pull,我收到此错误:

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/
Run Code Online (Sandbox Code Playgroud)

如果我从.yml中删除版本,那么我会收到这样的错误:

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for volumes: 'conf.d'
Unsupported config option for services: 'letsencrypt-companion'
Unsupported config option for networks: 'proxy-tier'
Run Code Online (Sandbox Code Playgroud)

阅读文档后,我的第一个想法是版本不兼容.所以我更新了docker 17.9.1-ce.
以下是版本docker-compose:

docker-compose version 1.8.0, build unknown
Run Code Online (Sandbox Code Playgroud)

但错误是一样的,我真的不知道这个.操作系统:Ubuntu 17.10.

til*_*ert 5

您需要升级 docker compose 以及可能的 docker 引擎。Docker compose 3.0 文件需要 docker 引擎版本 1.13.0+(以及该版本的 compose)。有关更多信息,请参阅: https: //docs.docker.com/compose/compose-file/,特别是 Compose 和 Docker Engine 兼容性矩阵。

请注意,版本 1.18.0 在版本 1.8.0 之后发布。它是版本 1.18.0,而不是版本 1.1.8.0。次要版本号不断增加(例如1.8.0 -> 1.9.0 -> 1.10.0 -> 1.11.0)。

最新版本(撰写本文时)是1.18,于2017年12月19日发布,1.8于2017年7月27日发布(https://github.com/docker/compose/releases)。您使用的是旧版本的 docker,与 docker-compose 3 文件不兼容。

此外,他们还更改了 docker 引擎的编号以反映发布日期:17.9.0 是 2017 年 9 月发布的版本(第一个数字是年份,第二个数字是月份)。