Deploying Portainer on a pure Windows 2019 Swarm Cluster

By popular demand, i will quickly show you the process to get Portainer and the Portainer Agent running in a Docker Swarm environment atop Windows Server 2019.

Note that due to a bug in Docker ( we are unable to deploy the Portainer instance as a service at this time.

First up, make sure your Swarm is initialized and working correctly; test overlay networking, and make sure all required firewall ports are open

  • netsh advfirewall firewall add rule name="cluster_management" dir=in action=allow protocol=TCP localport=2377
  • netsh advfirewall firewall add rule name="node_communication_tcp" dir=in action=allow protocol=TCP localport=7946
  • netsh advfirewall firewall add rule name="node_communication_udp" dir=in action=allow protocol=UDP localport=7946
  • netsh advfirewall firewall add rule name="overlay_network" dir=in action=allow protocol=UDP localport=4789
Step 1 Create the Agent Network
  • docker network create -d overlay portainer_agent_network --attachable
Step 2 - Deploy the Portainer Agent Across the Cluster
  • docker service create --name portainer_agent --network portainer_agent_network -e AGENT_CLUSTER_ADDR=tasks.portainer_agent --mode global --mount type=bind,src=C:\ProgramData\docker\volumes,dst=C:\ProgramData\docker\volumes --mount type=npipe,src=\\.\pipe\docker_engine,dst=\\.\pipe\docker_engine portainer/agent
Step 3 - Deploy Portainer "server"
  • docker run -d --name portainer -v portainer_data:C:\data --network portainer_agent_network --publish 9000:9000 portainer/portainer -H "tcp://tasks.portainer_agent:9001" --tlsskipverify

(again, note this is a container, so is not under swarm's management. If the host fails that is hosting Portainer, then Portainer is offline)

You can now connect to the IP address:9000 of the Docker Host that is running the Portainer "server" and commence using Portainer

Once the docker bug is fixed, we will revise these instructions.

Thanks to Steven Kang and William Conquest for providing this information.

Leave a comment!

All fields marked with an asterisk* are required.