[英]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.