yaml.parser.ParserError

ERROR: yaml.parser.ParserError: while parsing a block mapping in "./docker-compose.yml", line 15web

在寫docker-compose.yml文件

version: '2'
services:

  # PostgreSQL

  mydb:

    image: postgres:10

    ports:

      - "5432:5432"

    environment:

      - POSTGRES_DB=postgres

      - POSTGRES_USER=odoo

      - POSTGRES_PASSWORD=odoo

    volumes:

      - odoo-db-data:/var/lib/postgresql/data


  # Odoo web

  web:

   build:

      context: ../odoo_demo

      dockerfile: Dockerfile

    hostname: web

    command: ./docker_run_web.sh

    volumes:

      - ../odoo_demo:/app  # mount current directory inside container

    - odoo-web-data:/app/odoo-web-db # 把此路徑/app/odoo-ee-web-db配置到odoo conf data_dir參數中

   ports:

     - "8069:8069"

    # set up links so that web knows about db, rabbit and redis

    depends_on:

      - mydb


volumes:

 odoo-web-data:

 odoo-db-data:

文件寫完運行

docker-compose up -d

報錯:

ERROR: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yml", line 15, column 5
expected <block end>, but found '<block mapping start>'
in "./docker-compose.yml", line 25, column 4

查看發現問題(vim)

  • 緣由文件內塊對齊有問題,使用notepad++打開查看以下:redis

    volumes:
    
            - ../odoo_demo:/app  # mount current directory inside container
    
          - odoo-web-data:/app/odoo-web-db # 把此路徑/app/odoo-ee-web-db配置到odoo conf data_dir參數中

解決辦法:

  • 在下面這句話前面添加兩個空格,使他能和上面保持對其sql

    - odoo-web-data:/app/odoo-web-db # 把此路徑/app/odoo-ee-web-db配置到odoo conf data_dir參數中
相關文章
相關標籤/搜索