docker - 在 docker swarm stack deploy 期间没有在工作节点上创建覆盖网络
问题描述
我有一个带有单一管理器和 2 个工作节点的覆盖网络(名称覆盖测试)的 Docker 群集群。工作节点之一仅包含数据库服务器容器。当我在集群上部署堆栈并且我的堆栈不包含在工作节点上部署数据库服务器服务的说明时,我遇到了在节点上没有创建网络的问题。我的任务是手动将数据库服务器容器连接到该网络。我看到解决这个问题的唯一方法是使这个节点与 db 服务器作为群管理器,但群管理器应该只是其他主机。
有其他解决方法的想法吗?提前致谢。
用于部署的 Docker-compose:
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 network create -d overlay --attachable test-multihost
解决方案
推荐阅读
- node.js - 根据其他集合字段更新集合
- c++ - 为什么在按值捕获异常时将异常对象移动到 catch 子句对象不标准化,以防它没有被忽略?
- web - 在 Visual Studio 代码中以舒适的方式处理 FTP 服务器的任何扩展?
- xml - virsh 恢复对域标签的更改
- mysql - 等待连接到 mysql 服务器超时。请检查您的连接设置是否正确,并查看服务器是否正常运行
- sql - Spark Timestamp 格式的日期和时间 - 如何计算差异?
- reactjs - 链接 useEffects 并提前返回
- c++ - 具有重载集地址的函数调用被 Clang 和 GCC 拒绝
- android-jetpack-compose - 如何使文本的宽度等于另一个隐式测量文本的宽度?
- tinymce-4 - 如何在 TinyMCE 4.x 中调整属性窗口的大小?