I have a some code into my docker-compose file. Example below:
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
But when command 'docker-compose up' started I received a error: - docker-compose up ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in ".\docker-compose.yml", line 13, column 12
Help please. Tell why it was happen.
The syntax of docker-compose.yaml
file was wrong.
Try this
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
NOTE: build
, image
and depends_on
field should be aligned properly.
To verify syntax of docker-compose.yaml
make use of docker-compose config command.
docker-compose -f docker-compose.yaml config
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.