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: