docker-compose.yml文件属性后面一定记得先空格在加参数
version: "3"
services:
web:
# replace username/repo:tag with your name and image details
image: 192.168.250.69:5000/python:v1
deploy:
replicas: 5
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: 50M
ports:
- "81:80"
networks:
- webnet
visualizer:
image: dockersamples/visualizer:stable
ports:
- "8081:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
- webnet
networks:
webnet:
然后docker stack deploy -c docker-compose.yml getstartedlab运行成功