Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yaml.scanner.ScannerError: while scanning for the next token found character '\t' that cannot start any token

I am trying to create node and mongo service and run them in the same network using the docker compose file but it showing me this error "yaml.scanner.ScannerError: while scanning for the next token found character '\t' that cannot start any token" when i run docker-compose build command

can anyone please help me.

this is my docker-compose.yml file

version: '3'
services:
    node:
        build:
            context: .
            dockerfile: node.dockerfile
        ports:
            - "3000:3000"
        networks: 
            - nodeapp-network
    mongodb:
        image: mongo
        networks: 
            - nodeapp-network

networks: 
  nodeapp-network:
    driver: bridge
like image 730
Zahid Hussain Avatar asked Jun 21 '19 03:06

Zahid Hussain


2 Answers

Use spaces instead of tabs and the error will not persist

like image 62
Avi Maymon Avatar answered Oct 19 '22 00:10

Avi Maymon


You may be using "tab" to indent your YAML file.

The "tab" is not permitted by the YAML specs:

To maintain portability, tab characters must not be used in indentation, since different systems treat tabs differently. Note that most modern editors may be configured so that pressing the tab key results in the insertion of an appropriate number of spaces.

like image 27
Isanka Wijerathne Avatar answered Oct 18 '22 23:10

Isanka Wijerathne