Reputation: 1
I have Docker swarm cluster with overlay network (name overlay-test) with single-manager and 2 worker nodes. One of worker node contains only database server container. When I deploy stack on cluster and my stack doesn't contains instructions to deploy db server service on worker node I have an issue with no network creation on node. My task is to connect db server container to this network manually. The only way I see to resolve this is to make this node with db server as swarm manager, but swarm manager should be only other host.
Any ideas in another ways to resolve? Thanks in advance.
Docker-compose for deploy:
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
I created overlay network manually: docker network create -d overlay --attachable test-multihost
Upvotes: 0
Views: 1552
Reputation: 21
The network is to be created only on the Manager, they are seen by the workers only when there is a container using them.
Rif. : https://docker-docs.netlify.app/network/network-tutorial-overlay/#walkthrough
Inspect the nginx-net network on master, worker-1, and worker-2. Remember that you did not need to create it manually on worker-1 and worker-2 because Docker created it for you. The output will be long, but notice the Containers and Peers sections. Containers lists all service tasks (or standalone containers) connected to the overlay network from that host.
Upvotes: 2