SCG
SCG

Reputation: 73

Create a Swarm in multiple docker-compose with multi-host with dedicated servers

I have three servers each having defined docker containers by compose. I need to encrypt the communication between two of them and in the future I'll need replicas in at least one.

So I thought to create a swarm with overlay network, but I need each container to continue running in their currently dedicated server, so I cannot create a swarm with three nodes (one per server) and let the manager schedule the services replication.

So I've though about creating a swarm per each compose, so that when I need more nodes for some compose, I'll add a new dedicated server for this compose and it'll be added to the swarm of this compose as a node.

What I don't really know is if this is the best way to solve this architecture also how can be established the encrypted communication between the swarms directly.

Thanks

Upvotes: 0

Views: 674

Answers (1)

Light.G
Light.G

Reputation: 7304

I don’t think you need multiple swarm clusters, since docker swarm supports ability scheduling service on specific node(s) by one flag.

Add --constraint flag when executing docker service create.

If you are deploying applications with docker compose, then add constraints keyword in compose file.

constraints: [node.hostname == node_server]

Some introduction about constraint.

Upvotes: 1

Related Questions