加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

错误:不支持“./docker-compose.yml”中的版本.您可能会看到此

发布时间:2020-12-16 03:53:37 所属栏目:安全 来源:网络整理
导读:这是docker-compose.yml version: “2”services: web: build: . environment: MONGO_URI="mongodb://ravimongo:27017" ports: — “3000:3000” links: — ravimongo depends_on: — ravimongo ravimongo: image: mongo:3.2.6 ports: — “27017:27017” 这

这是docker-compose.yml

version: “2”
services:
  web:
   build: .
   environment:
    MONGO_URI="mongodb://ravimongo:27017"
   ports:
    — “3000:3000”
   links:
    — ravimongo
   depends_on:
    — ravimongo
  ravimongo:
   image: mongo:3.2.6
   ports:
     — “27017:27017”

这是错误:

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 supported version ("2.0","2.1","3.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-compose版本

docker-compose version 1.11.2,build dfed245
docker-py version: 2.1.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016

码头版

Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Tue Mar 28 00:40:02 2017
 OS/Arch:      darwin/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:00:50 2017
 OS/Arch:      linux/amd64
 Experimental: true

我在http://www.yamllint.com/和https://codebeautify.org/yaml-validator中验证了yaml语法.我无法找到问题.

最佳答案
YAML有效.但是,您使用左双引号“如此:

版本:“2”

根据错误,似乎Docker Compose无法正确解析版本.如果你使用的是left double quotation mark而不是quotation mark,那么Doc??ker编写的版本将是“2”而不是2,因此它不能将它等同于支持的版本(“2.0”,“2.1 “,”3.0“).我建议将其更改为以下内容:

版本:“2”

如果错误仍然存??在,请告诉我.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读