简体   繁体   English

Windows中的docker-compose:服务的不受支持的配置选项:“ web”

[英]docker-compose in windows: Unsupported config option for services: 'web'

I am trying to setup my first docker compose complete application, and I have created a spring boot application that depends on mongodb. 我正在尝试设置我的第一个docker compose完整应用程序,并且我创建了一个依赖于mongodb的spring boot应用程序。 So, I have created a docker-compose.yml file at the root of my code, at the same level of Dockerfile. 因此,我在代码的根目录(与Dockerfile处于同一级别)创建了一个docker-compose.yml文件。 When I create the image using gradlew build buildDocker everuthing goes fine, and the image is created and I can run it (but it fails because it cannot open mongodb connection). 当我使用gradlew build buildDocker创建映像时, gradlew build buildDocker everuthing可以正常运行,并且映像已创建并且可以运行(但是由于无法打开mongodb连接而失败)。 So, I created the docker-compose.yml this way: 因此,我以这种方式创建了docker-compose.yml:

services:
  web:
    build: .
    ports:
      - "8082:8082"
    links:
      - mongo
  mongo:
    environment:
      spring.data.mongodb.host: localhost
      spring.data.mongodb.port: 27017
      spring.data.mongodb.database: Transactions
      spring.data.mongodb.username: someUsername
      spring.data.mongodb.password: somePassword
    image: "mongo:3.4"

However, when I execute docker-compose up command, I get this error: 但是,当我执行docker-compose up命令时,出现以下错误:

Unsupported config option for services: 'web'

I am using Windows 10 as OS, and the version of docker compose is docker-compose version 1.14.0, build c7bdf9e3 我正在使用Windows 10作为OS,并且docker-compose version 1.14.0, build c7bdf9e3docker-compose version 1.14.0, build c7bdf9e3

Question: Does anyone knows how do I need to setup the docker-compose.yml file in order to not receive that error? 问题:有谁知道我该如何设置docker-compose.yml文件才能不接收该错误?

As @fernandezcuesta said, 正如@fernandezcuesta所说,
You need to add version number for each docker-compose file. 您需要为每个docker-compose文件添加版本号。

Example : 范例:

version: '3.0'
services:
  web:
    build: .
    ports:
      - "8082:8082"
    links:
      - mongo
  mongo:
    environment:
      spring.data.mongodb.host: localhost
      spring.data.mongodb.port: 27017
      spring.data.mongodb.database: Transactions
      spring.data.mongodb.username: someUsername
      spring.data.mongodb.password: somePassword
    image: "mongo:3.4"

See documentation for more details. 有关更多详细信息,请参见文档

暂无
暂无

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

相关问题 docker-compose:服务服务不支持的配置选项:'web' - docker-compose : Unsupported config option for services service: 'web' docker-compose:服务的配置选项不受支持:“redis” - docker-compose: Unsupported config option for services: 'redis' docker-compose:services.db 不支持的配置选项:“jupyter” - docker-compose: Unsupported config option for services.db: 'jupyter' docker-compose不支持的服务配置 - docker-compose unsupported config for services docker-compose:“运行时”不支持的配置选项 - docker-compose: Unsupported config option for 'runtime' 错误:撰写文件“./docker-compose.yml”服务的配置选项不受支持。web:“dockerfile” - ERROR: The Compose file './docker-compose.yml' Unsupported config option for services.web: 'dockerfile' 相当于docker-compose中的docker选项--config - equivalent of docker option --config in docker-compose 错误:撰写文件“.\docker-compose.yml”无效,因为:服务的配置选项不受支持。drupal:“postgres” - ERROR: The Compose file '.\docker-compose.yml' is invalid because: Unsupported config option for services.drupal: 'postgres' 错误:撰写文件“./docker-compose.yml”无效,因为:服务不支持的配置选项:“sqlite3” - ERROR: The Compose file './docker-compose.yml' is invalid because: Unsupported config option for services: 'sqlite3' Compose 文件“./docker-compose.yml”无效,因为:services.docker-image 的配置选项不受支持:“update_config” - The Compose file './docker-compose.yml' is invalid because: Unsupported config option for services.docker-image: 'update_config'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM