yaml.parser.ParserError: while parsing a block mapping yaml.parser.ParserError: while parsing a block mapping docker docker

yaml.parser.ParserError: while parsing a block mapping


The YAML you provided does not generate an error if the spaces there are indeed spaces. So check your YAML for Tab or other hidden characters.

import ruamel.yamlyaml_str = """\version: '2'services:  ubuntupgcsstateless:    image: ubuntupgstatelesscsimage    environment:      - EXTERNAL_IP=10.31.86.164      - EXTERNALDB_IP=10.31.86.165      - EXTERNALDB_ADMIN_USER=postgres      - EXTERNALDB_ADMIN_PASSWORD=password      - DOCBASENAME=DocbaseName    hostname:      "ubuntupgcsstateless"    container_name:      "ubuntupgcsstateless"    ports:     - "1689:1689"     - "1690:1690"     - "50000:50000"     - "50001:50001"     - "9080:9080"     - "9082:9082"    volumes:     - DocbaseName_data:/home/dmadmin/dctm/data     - DocbaseName_dba:/home/dmadmin/dctm/dba     - DocbaseName_share:/home/dmadmin/dctm/share     - DocbaseName_dfc:/home/dmadmin/dctm/config     - DocbaseName_xhive_storage:/home/dmadmin/dctm/xhive_storage     - DocbaseName_mdserver:/home/dmadmin/dctm/wildfly9.0.1/server/DctmServer_MethodServer    privileged: truevolumes: DocbaseName_data: DocbaseName_dba: DocbaseName_share: DocbaseName_dfc: DocbaseName_xhive_storage: DocbaseName_mdserver:"""data = ruamel.yaml.round_trip_load(yaml_str)print(ruamel.yaml.round_trip_dump(data))

Although not required by the YAML specification, you should consistently indent with the same number of spaces for keys in a mapping (you use 1 and 2 spaces, I recommend two) as well as elements in a sequence (again you use 1 and 2 spaces, I recommend using 0 for sequences that are mapping values).

Try the following with your Dockerfile and docker-compose:

version: '2'services:  ubuntupgcsstateless:    image: ubuntupgstatelesscsimage    environment:    - EXTERNAL_IP=10.31.86.164    - EXTERNALDB_IP=10.31.86.165    - EXTERNALDB_ADMIN_USER=postgres    - EXTERNALDB_ADMIN_PASSWORD=password    - DOCBASENAME=DocbaseName    hostname:      "ubuntupgcsstateless"    container_name:      "ubuntupgcsstateless"    ports:    - "1689:1689"    - "1690:1690"    - "50000:50000"    - "50001:50001"    - "9080:9080"    - "9082:9082"    volumes:    - DocbaseName_data:/home/dmadmin/dctm/data    - DocbaseName_dba:/home/dmadmin/dctm/dba    - DocbaseName_share:/home/dmadmin/dctm/share    - DocbaseName_dfc:/home/dmadmin/dctm/config    - DocbaseName_xhive_storage:/home/dmadmin/dctm/xhive_storage    - DocbaseName_mdserver:/home/dmadmin/dctm/wildfly9.0.1/server/DctmServer_MethodServer    privileged: truevolumes:  DocbaseName_data:  DocbaseName_dba:  DocbaseName_share:  DocbaseName_dfc:  DocbaseName_xhive_storage:  DocbaseName_mdserver:


Method 1:

  • you should open your docker-compose.yml file in notepad++ and enable the "show all characters" option so that you can see and rectify the spaces,tabs indentation problem

but if it will be little tough job for you

Method 2:

aftet this validate tool i can able to find the issue in my "docker-compose.yml" file i have some spaces,tabs indentation issue