compose.yml file, which looks like this:
version: \'2\'
services:
  discovery-microservice:
    build: discovery-microservice
      context: /discov         
        I wanted a volume mapped to a specific path on the external (host) server. I tried putting that under the top-level volumes entry in docker-compose.yml. After looking at the docker-compose file docs, I realized that that type of volume does not go there. Instead, it goes only under the volumes entry within the container definition. E.g.:
version: "3.7"
services:
  web:
    image: my_custom_web_image
    build: ./app
    volumes:
      - ./app/subdir:/usr/src/app/subdir
So, there is another reason! When you try to install r=Redash using the setup.sh from the Github, the script automatically gets the latest version of Redash and put it in docker-compose.yml. The base yml file doesn't have single-quotations (') around version name! As a result, you get an error that says:
ERROR: yaml.scanner.ScannerError: mapping values are not allowed here in "./docker-compose.yml", line 3, column 23 You just add single-quotation around the Redash version:
version: "2"
x-redash-service: &redash-service
  image: 'redash/redash:8.0.0.b32245'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
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 here
in ".\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
I encountered a similar issue today, a syntax error in the docker-compose.yml file that caused the same error.
version: '2'
services:
// Add your services here
  discovery-microservice:
    build: discovery-microservice
      context: ./discovery-microservice/target/docker
      dockerfile: Dockerfile
  ports:
   - "8761:8761"
Removing this line // Add your services here fixed my issue
version: '2'
services:
  discovery-microservice:
    build:
      context: ./discovery-microservice/target/docker
      dockerfile: Dockerfile
    ports:
     - "8761:8761"
I hope this helps someone with a similar issue.
If you are using vs code do yourself a favor and install YAML extension by "RedHat".