John William
John William

Reputation: 31

ERROR: yaml.scanner.ScannerError: while scanning a simple key

I get the following error from docker-compose:

 docker-compose up -d
ERROR: yaml.scanner.ScannerError: while scanning a simple key
  in "./docker-compose.yml", line 4, column 1
could not find expected ':'
  in "./docker-compose.yml", line 5, column 1

This is my docker-compose.yaml:

version: '2.0'
services:

  #PHP Service
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: cloudsigma.com/php
    container_name: app
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
    working_dir: /var/www/html/
    volumes:
      - ./:/var/www/html/
      - ./php/laravel.ini:/usr/local/etc/php/conf.d/laravel.ini
    networks:
      - app-network

Can somebody tell me what is wrong with my compose file?

Upvotes: 3

Views: 26104

Answers (1)

Mehmoodul haq
Mehmoodul haq

Reputation: 386

Seems Like you have copied yml file from any other editor ( Like, if you share the compose file using Slack, you get this error )

Solution: Copy your code and past it to some online yml validator (https://codebeautify.org/yaml-validator) and you will find some red dots extra. Remove those and your are done.

I hope this helps someone still facing this situation

Upvotes: 12

Related Questions