【docker】 yaml.scanner.ScannerError: mapping values are not allowed here in "./docker-compose.yml", line 60, column 35

在启动docker-compose 时候 报错了

命令:

docker-compose up -d && docker-compose logs -f

错误代码:

 

 

解决

出现这个错误的是因为yml格式不正确,谷歌定义的yml格式太严格了,每个冒号后面都必须带有空格

 

原格式:

version:"3"
services:
  web:   
    image: licerlee/friendlyhello:v1
    deploy:
      replicas:5
      resources:
        limits:
          cpus:"0.1"
          memory:50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:

改为:

version: "3"
services:
  web:
   
    image: licerlee/friendlyhello:v1
    deploy:
      replicas: 5
      resources:
        limits:
          cpus: "0.1"
          memory: 50M
      restart_policy:
        condition: on-failure
    ports:
      - "80:80"
    networks:
      - webnet
networks:
  webnet:

备注: 上边示例仅供说明,并非我项目的配置文件

 

 

在执行命令:

 

 完事!

 

posted @ 2019-11-15 00:45  依然范儿特西  阅读(3164)  评论(1编辑  收藏  举报