简体   繁体   English

docker-compose不支持的服务配置

[英]docker-compose unsupported config for services

I am using below version of docker and docker-compose - 我正在使用以下版本的docker和docker-compose -

Docker version 17.03.1-ce, build c6d412e

docker-compose version 1.11.2, build dfed245

I still face issues with - 我仍然面临着问题 -

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.web: 'version'

below is my docker file - 下面是我的泊坞文件 -

version: '2'
services:
  web:
    build: .
    ports:
      - "80:80"
      - "443:443"
    links:
      - memache:memcahced
      - solr:solr
      - dev_mysql:dev_mysql
    container_name: xyz
    hostname: XYZ
    image: XYZ/mono
    version: latest
    privileged: true
 ...
 ...

Need some assistance. 需要一些帮助。

Don't know if it's just your question, but the indentation of your compose file is off, and there are a number of typos. 不知道这只是你的问题,但你的撰写文件的缩进是关闭的,并且有一些拼写错误。

Not clear what you're trying to do with that version property in the service definition (no such property is documented ), but if you want to specify the version of the image to be used, you do that as follows: 不太清楚你想与做什么version的服务定义(没有这样的属性是财产证明 ),但如果你想指定图像的版本中使用,你这样做,如下所示:

services:
  web:
    image: XYZ/mono:latest

As already some people pointed out, your indentation is broken. 正如有些人所指出的那样,你的缩进就被打破了。 You can verify your docker-compose YAML files with docker-compose config . 您可以使用docker-compose config验证docker-compose YAML文件。 This checks docker-compose.yml . 这会检查docker-compose.yml If you want to check a different YAML, you can specify it with -f , eg docker-compose -f docker-compose.prod.yml config 如果要检查其他YAML,可以使用-f指定它,例如docker-compose -f docker-compose.prod.yml config

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM