美文网首页
docker问题:ERROR: yaml.scanner.Sca

docker问题:ERROR: yaml.scanner.Sca

作者: Seaofdesire | 来源:发表于2018-04-15 20:21 被阅读0次

    Docker-compose up时报错:

    ERROR: yaml.scanner.ScannerError: mapping values are not allowed here
    in "./docker-compose.yml", line 2, column 9

    解决

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

    错误

    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问题:ERROR: yaml.scanner.Sca

          本文链接:https://www.haomeiwen.com/subject/vvrjkftx.html