此处不允许yml docker-compose错误映射值

时间:2019-09-16 15:22:27

标签: docker docker-compose yaml

我尝试了解容器,但是我的docker-compose.yml文件有问题,在运行docker compose之后,我总是遇到相同的错误:

  

“错误:yaml.scanner.ScannerError:不允许映射值   在这里”

即使我将装载路径更改为docker volume,我仍然遇到相同的错误,这是我的{ '$$typeof': Symbol(react.element), type: [Function], key: null, ref: null, props: {}, _owner: null, _store: {} } 文件

"jest": "^21.2.1",
"@testing-library/jest-dom": "^4.1.0",
"@testing-library/react": "^9.1.4",
"react": "^16.8.6",
"react-dom": "^16.0.0",
"react-redux": "^5.0.5",
"redux": "^3.7.2",
"redux-saga": "^0.15.6",

1 个答案:

答案 0 :(得分:0)

您的Yaml似乎无效。当我遇到此类问题时,我将使用一个名为http://www.yamllint.com/的网站来为您验证语法。

基于您的示例的该Yaml有效:

注意:您可以使用4个空格(或2个我喜欢的空格),但绝不能使用制表符。

version: "3"

services: 
  database: 
    environment: 
      MYSQL_ROOT_PASSWORD: root
    image: mariadb
    ports: 
      - "3260:3260"
    volumes: 
      - "/home/randy/Desktop/Latihan/wordpress-mariadb/mariadb:var/lib/mysql"
  wordpress:
    image: wordpress
    ports:
      - "2000:80"
    volumes:
      - /home/randy/Desktop/Latihan/wordpress-mariadb/wordpress:/var/www/html
    environment:
      WORDPRESS_DB_PASSWORD: root
    depends_on:
      - database
    links:
      - database