docker swarm 列出服务的依赖项
docker swarm list dependencies of a service
假设我们有以下堆栈文件:
version: "3"
services:
ubuntu:
image: ubuntu
deploy:
replicas: 2
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: 50M
entrypoint:
- tail
- -f
- /dev/null
logging:
driver: "json-file"
ports:
- "80:80"
networks:
- webnet
web:
image: httpd
ports:
- "8080:8080"
hostname: "apache"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
resources:
limits:
memory: 32M
reservations:
memory: 16M
depends_on:
- "ubuntu"
networks:
- webnet
networks:
webnet:
当我 运行 docker service inspect mystack_web
生成的输出不显示对 depends_on 条目的任何引用。
可以吗?以及如何打印给定 docker 服务的依赖项?
depends_on
未用于 docker 集群:
The depends_on
option is ignored when deploying a stack in swarm mode with a version 3 compose file. - from Docker Docs
关于GitHub的另一个很好的解释:
depends_on
is a no-op when used with docker stack deploy
. Swarm mode services are restarted when they fail, so there's no reason to delay their startup. Even if they fail a few times, they will eventually recover. - from GitHub
假设我们有以下堆栈文件:
version: "3"
services:
ubuntu:
image: ubuntu
deploy:
replicas: 2
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: 50M
entrypoint:
- tail
- -f
- /dev/null
logging:
driver: "json-file"
ports:
- "80:80"
networks:
- webnet
web:
image: httpd
ports:
- "8080:8080"
hostname: "apache"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
resources:
limits:
memory: 32M
reservations:
memory: 16M
depends_on:
- "ubuntu"
networks:
- webnet
networks:
webnet:
当我 运行 docker service inspect mystack_web
生成的输出不显示对 depends_on 条目的任何引用。
可以吗?以及如何打印给定 docker 服务的依赖项?
depends_on
未用于 docker 集群:
The
depends_on
option is ignored when deploying a stack in swarm mode with a version 3 compose file. - from Docker Docs
关于GitHub的另一个很好的解释:
depends_on
is a no-op when used withdocker stack deploy
. Swarm mode services are restarted when they fail, so there's no reason to delay their startup. Even if they fail a few times, they will eventually recover. - from GitHub