docker version:17.03.1-ce
尝试从入门教程开始使用docker-compose.yml。
version: "3"
services:
web:
image: tuhina/friendlyhello:2.0
deploy:
replicas: 5
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet:
出现此错误:
replicas Additional property replicas is not allowed
我输错了什么?
感谢。
编辑:docker-compose版本1.11.2,build dfed245
答案 0 :(得分:41)
缩进在docker-compose.yml中至关重要。你设置它的方式,"部署"是一项服务,不是故意的。部署部分旨在指定有关" web"应该部署服务。以下内容允许docker-compose up
和docker stack deploy web --compose-file docker-compose.yml
成功为我运行:
version: "3"
services:
web:
image: tuhina/friendlyhello:2.0
deploy:
replicas: 5
resources:
limits:
cpus: "0.1"
memory: '50M'
restart_policy:
condition: on-failure
ports:
- "80:80"
networks:
- webnet
networks:
webnet: