我有一个单管理器和2个工作节点的带有覆盖网络(名称覆盖测试)的Docker群集群。工作节点之一只包含数据库服务器容器。当我在集群上部署堆栈,并且我的堆栈不包含在工作节点上部署db服务器服务的指令时,我在节点上没有网络创建的问题。我的任务是手动将db服务器容器连接到此网络。解决这个问题的唯一方法是使这个节点以db服务器作为群集管理器,但是群集管理器只应该是其他主机。
有别的办法解决吗?提前谢谢。
码头工人-组成以供部署:
version: "3.5"
services:
test-front:
build: ./host-front/test-front
image: test-front:alpine-3
depends_on:
- test-back
networks:
- test-multihost
deploy:
replicas: 1
placement:
constraints:
- node.labels.nodename == front
test-back:
build: ./host-front/test-back
image: test-back:openjdk8-alpine
restart: always
networks:
- test-multihost
depends_on:
- test-db
deploy:
replicas: 1
placement:
constraints:
- node.labels.nodename == front
test-adapter:
build: ./host-front/test-adapter
image: test-adapter:openjdk8-alpine
restart: always
networks:
- test-multihost
depends_on:
- test-core
deploy:
replicas: 1
placement:
constraints:
- node.labels.nodename == front
test-core:
build: ./host-main/test-core
image: test-core:openjdk8-alpine
restart: always
depends_on:
- test-db
networks:
- test-multihost
deploy:
replicas: 1
placement:
constraints:
- node.labels.nodename == main
test-db:
build: ./host-main/test-db
image: test-db:openjdk8-alpine
restart: always
depends_on:
- test-postgres
networks:
- test-multihost
deploy:
replicas: 1
placement:
constraints:
- node.labels.nodename == main
test-postgres:
build: ./host-db/test-postgres
image: test-postgres:postgres-12.1-alpine
restart: always
networks:
- test-multihost
deploy:
replicas: 1
placement:
constraints:
- node.labels.nodename == db
networks:
test-multihost:
external: true我手动创建了覆盖网络: docker网络创建-d覆盖-可附加测试-多主机
发布于 2022-08-25 08:10:54
网络只能在Manager上创建,只有当有容器使用它们时,员工才会看到它们。
里夫。:https://docker-docs.netlify.app/network/network-tutorial-overlay/#walkthrough
检查主、工-1和工-2上的nginx-net网络.请记住,您不需要在worker-1和worker-2上手动创建它,因为Docker为您创建了它。输出将很长,但请注意容器和对等部分。Containers列出从该主机连接到覆盖网络的所有服务任务(或独立容器)。
https://stackoverflow.com/questions/60174026
复制相似问题