簡體   English   中英

如何將錯誤修復到我的 docker 撰寫文件中

[英]How to fix error into my docker compose file

我的 docker-compose 文件中有一些代碼。 下面的例子:

version: '3.4'

services:

  api.gw:
    image: ocelotapigw
    build:
      context: .
      dockerfile: src/OcelotApiGw/Dockerfile

  catalog.api:
    image: catalogapi
      build:
        context: .
        dockerfile: src/Services/Catalog.Api/Dockerfile

      depends_on:
        - api.gw

  identity.api:
    image: identityapi
      build:
        context: .
        dockerfile: src/Services/Identity.Api/Dockerfile

      depends_on:
        - api.gw

  eshop:
    image: eshop
    build:
      context: .
      dockerfile: src/eShop/Dockerfile

    depends_on:
      - api.gw

但是當命令 'docker-compose up' 啟動時,我收到一個錯誤: - docker-compose up ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in ".\docker-compose.yml", line 13, column 12

請幫忙。 告訴它為什么會發生。

docker-compose.yaml文件的語法錯誤。

嘗試這個

version: '3.4'

services:

  api.gw:
    image: ocelotapigw
    build:
      context: .
      dockerfile: src/OcelotApiGw/Dockerfile

  catalog.api:
    image: catalogapi
    build:
      context: .
      dockerfile: src/Services/Catalog.Api/Dockerfile

    depends_on:
      - api.gw

  identity.api:
    image: identityapi
    build:
      context: .
      dockerfile: src/Services/Identity.Api/Dockerfile

    depends_on:
      - api.gw

  eshop:
    image: eshop
    build:
      context: .
      dockerfile: src/eShop/Dockerfile

    depends_on:
      - api.gw

注意: buildimagedepends_on字段應該正確對齊。

要驗證docker-compose.yaml的語法,請使用docker-compose 配置命令。

docker-compose -f docker-compose.yaml config

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM