Docker-Compose file has yaml.scanner.ScannerError

后端 未结 17 2098
情话喂你
情话喂你 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:54

    Bringing my answer because while I got the same error message, my solution was different.

    Original docker-compose.yml

    volumes: mongo:
    

    After trying all the ideas in this thread I just went to the docker-compose docks and realized that volumes should be structured like:

    volumes:
      mongo:
    

    That's it for anyone else running into this.

    0 讨论(0)
  • 2021-02-01 12:55

    Check your whitespaces by validating your YAML input.

    I spent 1hour to find out.

    0 讨论(0)
  • 2021-02-01 12:57

    I found that missing one ":", was enough to produce the above error

    0 讨论(0)
  • 2021-02-01 12:58

    And I forgot : after version

    version '2'
    
    0 讨论(0)
  • 2021-02-01 13:00

    Hi further update to the given answer .... It's not specifically about the version: '2.0' line The statement

    ERROR: yaml.scanner.ScannerError: mapping values are not allowed here

    means there's a formatting error of some sort.

    I got it and it was because I was missing a tab in my docker-compose file

    version: '3.0'
    services:
      mysql:
      image: ...
    

    instead of

    version: '3.0'
    services:
      mysql:
        image: ...
    

    Note the lack of an indenting tab on the image line

    0 讨论(0)
提交回复
热议问题