Taiane Barbosa
Taiane Barbosa

Reputation: 31

Docker compose: expected a mapping or list of mappings for merging, but found scalar

I'm trying to use the following guide to setup Redash on Docker under a Windows environment:

https://medium.com/@ikishan/creating-a-new-age-dashboard-with-self-hosted-open-source-redash-41e91434390

But when I reach the following step:

docker-compose run --rm server create_db

I get this error:

ERROR: yaml.constructor.ConstructorError: while constructing a mapping in ".\docker-compose.yml", line 1, column 1

expected a mapping or list of mappings for merging, but found scalar in ".\docker-compose.yml", line 2, column 19

The first two lines are configured in docker-compose.yml as it follows:

1: version: ‘2’

2: x-redash-service: &redash-service

Column 19 in line 2 is "&".

What could be the source of this error?

Upvotes: 3

Views: 4932

Answers (1)

plshelpmeout
plshelpmeout

Reputation: 129

Turns out identation was completely broken:

version: '2'
x-redash-service: &redash-service
  image: redash:latest
  depends_on:
    - postgres
    - redis
  env_file: redash.env
  restart: always
services:
  server:
    <<: *redash-service
    command: server
    ports:
      - "5000:5000"
    environment:
      REDASH_WEB_WORKERS: 4
  scheduler:
    <<: *redash-service
    command: scheduler
    environment:
      QUEUES: "celery"
      WORKERS_COUNT: 1
  scheduled_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "scheduled_queries,schemas"
      WORKERS_COUNT: 1
  adhoc_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "queries"
      WORKERS_COUNT: 2
  redis:
    image: redis:latest
    restart: always
  postgres:
    image: postgres:latest
    env_file: redash.env
    restart: always
  nginx:
    image: redash/nginx:latest
    ports:
      - "80:80"
    depends_on:
      - server
    links:
      - server:redash
    restart: always

Upvotes: 3

Related Questions