首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >docker合成文件无效,不允许附加属性tty

docker合成文件无效,不允许附加属性tty
EN

Stack Overflow用户
提问于 2017-02-17 00:04:30
回答 1查看 4K关注 0票数 2

我真的需要关于这个错误的帮助,我不明白为什么我会得到这个错误。谢谢

代码语言:javascript
复制
docker -v
Docker version 1.13.1, build 092cba3
docker-compose -v
docker-compose version 1.11.1, build 7c5d5e4

这是我的dockerfile

代码语言:javascript
复制
version: '2.0'

services:
  arcgis-server:
    container_name: "arcgis-server"
    image: "arcgis-server:10.4.1"
    volumes:
      - "./license:/license"
      - "./arcgisserver:/arcgis/server/usr/directories"
      - "./config-store:/arcgis/server/usr/config-store"
    build:
      context: .
      dockerfile: "Dockerfile"
    ulimits:
      nproc: 25059
      nofile:
        soft: 65535
        hard: 65535
    ports:
      - "127.0.0.1:6080:6080"
      - "127.0.0.1:6443:6443"
      - "4001:4001"
      - "4002:4002"
      - "4004:4004"
    stdin_open: true
tty: true

下面是错误

代码语言:javascript
复制
docker-compose build
ERROR: The Compose file './docker-compose.yml' is invalid because:
Additional properties are not allowed ('tty' was unexpected)

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/

实际上,我在旧机器上进行了测试,它工作得很好。我会感谢你的帮助。再次感谢!

EN

回答 1

Stack Overflow用户

发布于 2017-02-17 00:20:02

需要将tty定义为服务上的设置,而不是顶级设置。Yaml文件是空间敏感的,因此删除前导空格会将设置置于无效的顶层。使用以下语法对其进行修复:

代码语言:javascript
复制
version: '2.0'

services:
  arcgis-server:
    container_name: "arcgis-server"
    image: "arcgis-server:10.4.1"
    volumes:
      - "./license:/license"
      - "./arcgisserver:/arcgis/server/usr/directories"
      - "./config-store:/arcgis/server/usr/config-store"
    build:
      context: .
      dockerfile: "Dockerfile"
    ulimits:
      nproc: 25059
      nofile:
        soft: 65535
        hard: 65535
    ports:
      - "127.0.0.1:6080:6080"
      - "127.0.0.1:6443:6443"
      - "4001:4001"
      - "4002:4002"
      - "4004:4004"
    stdin_open: true
    tty: true
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42278941

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档