Docker-Compose file has yaml.scanner.ScannerError Docker-Compose file has yaml.scanner.ScannerError docker docker

Docker-Compose file has yaml.scanner.ScannerError


Ok, I wasted around 3 hours to debug a similar issue.

If you guys ever get the below error

ERROR: yaml.scanner.ScannerError: mapping values are not allowed herein ".\docker-compose.yml", line 2, column 9

It's because a space is needed between

version:'3' <-- this is wrong

version: '3' <-- this is correct.

Also, if you are using eclipse, do yourself a favor and install the YEdit YAML editor plugin


Literally found the solution seconds later. You have to remove the "discovery-microservice" after "build":

version: '2'services:  discovery-microservice:    build:      context: ./discovery-microservice/target/docker      dockerfile: Dockerfile    ports:     - "8761:8761"

Also you can use "./" in context for relative paths. :)


And I forgot : after version

version '2'