Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk10 min

How to Create a Docker Swarm on Linux VPS Servers

Set up Docker Swarm across Linux VPS servers: prepare node networking, initialize a manager, join workers or managers, secure tokens, open the right firewall ports, test ingress, and fix common failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To create a Docker Swarm on Linux VPS servers, install Docker Engine on every VPS, initialize one VPS as the manager with docker swarm init --advertise-addr <MANAGER_IP>, join the remaining machines with the worker or manager token, and verify the cluster with docker node ls. The nodes must be able to reach one another on the Swarm control-plane and overlay-network ports before you initialize the cluster.

What a Docker Swarm on VPS servers does

Docker Swarm mode turns several Docker Engine installations into one cluster. A manager maintains the desired state of services and coordinates scheduling. Worker nodes run the containers assigned to them. A manager can also run workloads unless you deliberately restrict it, so a small cluster does not require separate hardware for control and application tasks.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Swarm mode includes mutual TLS for node communication, a built-in certificate authority, service scheduling, rolling updates, and overlay networking. When a service port is published through the routing mesh, a request arriving at a node can be forwarded to the node running the service task. That makes the cluster useful when application containers move between VPS servers, but it also means the firewall and published-port design must be intentional.

Plan the VPS topology before installing anything

Choose the first manager

Select one VPS with a stable address and enough capacity to remain reachable while the cluster is being administered. This machine becomes the initial manager. The address passed to --advertise-addr is the address other Swarm nodes use to contact that manager, not merely an address that exists on the machine.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

If your VPS provider supplies a private network shared by the machines, prefer the manager’s private, node-to-node address for Swarm traffic. If no private network is available, use the manager address that every other node can reach. Confirm the provider’s routing and firewall behavior first; an address that is reachable from your laptop is not automatically reachable from every VPS.

Decide which nodes are workers and which are managers

Use worker nodes for application capacity when you want the smallest administrative surface. Additional managers provide control-plane redundancy, but every manager holds sensitive cluster state and must be protected as carefully as the first manager. The role is selected by the token used during docker swarm join; a worker token cannot create a manager, and a manager token grants control of the Swarm.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Give each VPS a distinct hostname and record its private and public addresses. Clear names make docker node ls, placement constraints, and incident response much easier to understand.

Open only the required node-to-node ports

Configure the operating-system firewall and any VPS-provider firewall before running docker swarm init. The following ports are the standard Swarm mode requirements. Restrict them to the IP addresses of your Swarm nodes rather than exposing them to the entire internet.

Port or protocol Transport Purpose Exposure guidance
2377 TCP Swarm control-plane communication, including communication with and between manager nodes Allow only between trusted Swarm nodes; do not publish it publicly
7946 TCP and UDP Overlay-network node discovery Allow between all Swarm nodes
4789 UDP Overlay-network traffic, normally using VXLAN Allow between all Swarm nodes
IP protocol 50 IPSec ESP Encrypted overlay networks created with --opt encrypted Allow between nodes only when you use encrypted overlays

Ports used by your application are separate from these cluster ports. For example, if a service publishes HTTP on port 80, open TCP 80 to the public only if that service is intended to be public. Do not substitute old Docker Swarm Classic port lists for Swarm mode. Community lists sometimes include port 2376, while older Swarm Classic examples mention ports such as 2375, 3375, or 8500; those lists do not describe the current Swarm mode control-plane requirements.

Docker’s port requirements and implementation details can change. Verify the current Docker documentation and your provider’s networking rules before production deployment, especially when using encrypted overlays or a private VPS network.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Docker Engine on every VPS

Install Docker Engine on the manager and every intended worker or additional manager. Use the installation instructions for the Linux distribution running on each VPS; the Swarm commands do not install Docker for you.

  • Install and start the Docker Engine service on every machine.
  • Ensure the account that will run the commands can use Docker, either as root or through the system’s Docker group policy.
  • Confirm that each VPS can resolve or reach the selected manager address.
  • Apply operating-system updates and configure time synchronization before placing nodes in the cluster.
  • Keep Docker Engine versions compatible across the cluster and check release notes before upgrading a manager or worker.

Run docker version and docker info on each VPS as a basic preflight. If Docker is not running, fix that service first; a Swarm join failure is often only a symptom of a stopped Docker daemon or a blocked provider firewall.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Initialize the first manager

Connect to the VPS that will be the initial manager and run the following command, replacing the example address with the address that the other nodes can actually reach:

docker swarm init --advertise-addr <MANAGER_IP>

Docker’s reference example uses 192.168.99.121:

docker swarm init --advertise-addr 192.168.99.121

The address in the example is illustrative. Do not copy it unless it is the real, routable address of your manager.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A successful command reports that the Swarm was initialized and identifies the current node as a manager. Initialization creates a self-signed Swarm root certificate authority, a worker join token, a manager join token, and the built-in ingress overlay network used when services publish ports through the routing mesh.

If the command selects the wrong interface or address, stop before joining other nodes. Recheck the VPS routing table, private-network configuration, and provider firewall. Joining nodes to a manager advertised on an unreachable address creates a cluster that appears initialized locally but cannot accept healthy members.

Join worker VPS servers

The initialization output includes a worker command containing a secret token and the manager’s address on TCP port 2377. Run that command on each worker VPS:

docker swarm join --token <WORKER_TOKEN> <MANAGER_IP>:2377

Replace both placeholders with the values printed by docker swarm init. Run the command on the worker, not on the manager. A successful join confirms that the node joined as a worker.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Never paste a real join token into a public ticket, shell-history screenshot, tutorial, or chat room. Anyone who obtains a valid manager token may add a manager with control over the entire cluster.

Add another manager when you need manager capacity

Use the manager join command printed by the initial manager when adding a control-plane node. Its form is:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
docker swarm join --token <MANAGER_TOKEN> <MANAGER_IP>:2377

Only use the manager token on a machine that should administer the cluster. Protect manager VPSs more strictly than ordinary workers, because they contain the cluster’s control-plane state and can change services, secrets, networks, and node membership.

Retrieve or rotate join tokens

If the original initialization output is no longer available, run these commands on an existing manager:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker swarm join-token worker
docker swarm join-token manager

Each command prints the appropriate join command. Add -q when you need only the token value, for example:

docker swarm join-token -q worker
docker swarm join-token -q manager

Rotate a token after it has been exposed or when your operating procedure requires a new credential. The rotation form is:

docker swarm join-token --rotate worker
docker swarm join-token --rotate manager

Rotation invalidates the previous token for future joins. It does not remove nodes that have already joined. Existing nodes remain members until you explicitly remove them or they leave the Swarm.

Verify the cluster from a manager

Run this command on a manager:

docker node ls

The output should list the initial manager and every joined node. Check each node’s role and availability. A worker should show the worker role; a node joined with the manager token should show the manager role. If a node is missing, run docker info on that VPS and inspect the Docker daemon logs using the logging method provided by its Linux distribution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Also test basic reachability in both directions. A node can reach the manager while the manager cannot return traffic because of stateful firewall rules, or TCP 2377 can be open while UDP 7946 and 4789 remain blocked. Swarm membership requires the full set of required paths, not just a successful TCP connection to the manager.

Deploy a small service to test scheduling and ingress

After all nodes appear correctly, deploy a disposable service to verify that scheduling and published ports work. For example:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
docker service create 
  --name web-test 
  --publish published=8080,target=80 
  nginx

This creates a replicated service with one task and publishes port 8080 on the Swarm routing mesh. The image shown is only a test workload; replace it with an image you control for real applications.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the service and its task placement from a manager:

docker service ls
docker service ps web-test
docker service inspect web-test

Open TCP 8080 only where you intend to accept traffic, then connect to a node address on that port. With the routing mesh, the request can enter through a node that is not currently running the task and be forwarded across the Swarm. If you do not want every node to accept the published port, use a service design and ingress strategy that matches that requirement rather than assuming a host-published port behaves the same way.

Remove the test service when validation is complete:

docker service rm web-test
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Encrypted overlays: when the extra protocol is required

Swarm’s normal overlay traffic uses UDP 4789 between nodes. If you create an encrypted overlay with the --opt encrypted option, the nodes also need IP protocol 50 (IPSec ESP) permitted between them. Many VPS firewalls are configured only for TCP and UDP, so an encrypted network can fail even when ports 2377, 7946, and 4789 appear open.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Allow ESP only between the participating nodes. Do not expose it broadly to the internet. Confirm that your VPS provider passes protocol 50 before making encrypted overlays a production dependency.

Troubleshoot the most common creation failures

“This node is not a manager”

Administrative commands such as docker node ls require a manager. Connect to the initial manager or another manager. If the machine was joined with a worker token, leave it and rejoin with the manager token only if it is genuinely intended to be a manager.

The join command times out

  • Confirm TCP 2377 is allowed from the worker’s source address to the manager.
  • Confirm the manager’s advertised address is the address the worker can route to.
  • Check both the VPS-provider firewall and the Linux host firewall.
  • Verify that the Docker daemon is running on both machines.

The node joins but remains unavailable or networking fails

Check TCP and UDP 7946 and UDP 4789 in both directions between all nodes. A one-way rule, NAT layer, or provider network policy can allow the join handshake while breaking node discovery or overlay traffic. If you enabled an encrypted overlay, check IP protocol 50 as well.

The wrong role appears in docker node ls

The role is determined by the token. Generate the correct command on a manager with docker swarm join-token worker or docker swarm join-token manager, then use that command on the target VPS. Do not edit a token by hand.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A token was leaked

Rotate the affected token immediately, then distribute the new command through a private channel. Rotation prevents new joins with the old token; review existing nodes separately and remove any machine that should not be trusted.

The manager address is wrong after initialization

Do not try to solve an address mistake by repeatedly joining workers. First determine whether the advertised address is reachable from every node. If the manager was initialized with an unusable address and the cluster is disposable, the cleanest recovery is often to remove the incomplete Swarm and initialize it again with the correct address. Preserve any required service definitions and secrets before destructive recovery.

Safely remove a node or dismantle a test Swarm

For a temporary worker, run docker swarm leave on that worker. A manager should be removed through a planned manager-removal procedure from another manager when the cluster contains important workloads. For a disposable test manager that is the only manager, Docker provides a force option, but it destroys that node’s local Swarm membership and should not be used as a routine repair:

docker swarm leave --force

Before removing production nodes, reschedule or drain their workloads according to your service strategy and confirm that the remaining nodes can maintain the desired capacity. Keep backups of application data separately; leaving a Swarm does not create a backup of volumes or databases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Production checklist

  • Docker Engine is installed and running on every intended node.
  • The manager advertises an address reachable by all Swarm nodes.
  • TCP 2377, TCP/UDP 7946, and UDP 4789 are permitted only between node addresses.
  • IP protocol 50 is permitted between nodes if encrypted overlays are used.
  • Public application ports are opened separately from cluster ports.
  • Worker and manager tokens are stored as secrets, and exposed tokens are rotated.
  • docker node ls shows every expected node with the intended role and availability.
  • A test service can be scheduled, inspected, reached on its published port, and removed cleanly.
  • Manager access is limited to administrators, and manager VPSs receive the strongest host-level protection.
  • Port requirements are checked against the current Docker documentation and your VPS provider before production.

How to think about the final design

The actual cluster creation is short: initialize one manager, join workers or additional managers, and verify membership. Reliability depends on the surrounding decisions. A private node network reduces the amount of Swarm traffic exposed to the internet when your provider supports it. A worker-only design limits the number of machines that can alter cluster state. Tight source-address firewall rules protect the control plane, while explicit application rules keep published services separate from management traffic.

Once those boundaries are in place, Swarm’s generated certificates, role-specific tokens, overlay network, and routing mesh provide the mechanics for running services across Linux VPS servers without treating every VPS as an isolated Docker installation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.