首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在码头群堆栈部署过程中,没有在员工节点上创建覆盖网络。

在码头群堆栈部署过程中,没有在员工节点上创建覆盖网络。
EN

Stack Overflow用户
提问于 2020-02-11 17:06:23
回答 1查看 524关注 0票数 0

我有一个单管理器和2个工作节点的带有覆盖网络(名称覆盖测试)的Docker群集群。工作节点之一只包含数据库服务器容器。当我在集群上部署堆栈,并且我的堆栈不包含在工作节点上部署db服务器服务的指令时,我在节点上没有网络创建的问题。我的任务是手动将db服务器容器连接到此网络。解决这个问题的唯一方法是使这个节点以db服务器作为群集管理器,但是群集管理器只应该是其他主机。

有别的办法解决吗?提前谢谢。

码头工人-组成以供部署:

代码语言:javascript
复制
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覆盖-可附加测试-多主机

EN

回答 1

Stack Overflow用户

发布于 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列出从该主机连接到覆盖网络的所有服务任务(或独立容器)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60174026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档