[英]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
注意: build
、 image
和depends_on
字段應該正確對齊。
要驗證docker-compose.yaml
的語法,請使用docker-compose 配置命令。
docker-compose -f docker-compose.yaml config
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.