【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

错误代码:

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

 

 

解决

出现这个错误的是因为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:

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

 

 

在执行命令:

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

 

 完事!

 

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

上一篇:B-1001 害死人不偿命的(3n+1)猜想 (15 分)


下一篇:IEEE 754标准