Docker-Compose file has yaml.scanner.ScannerError

后端 未结 17 2064
情话喂你
情话喂你 2021-02-01 12:04

compose.yml file, which looks like this:

version: \'2\'
services:
  discovery-microservice:
    build: discovery-microservice
      context: /discov         


        
17条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-01 12:50

    Also make sure you have context and dockerfile at the same identation. I made a mistake and was stuck for hours.

    My error was

    ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "./docker-compose.yml", line 6, column 19

    Wrong:

    version : '3'
    services:
      test:
        build:
          context: ./test
            dockerfile: Dockerfile.test
        image: kpod/test:2020
    

    Right:

    version : '3'
    services:
      test:
        build:
          context: ./test
          dockerfile: Dockerfile.test
        image: kpod/test:2020
    

提交回复
热议问题