---
title: "Docker Swarm 2020(2)Docker Swarm and Portainer"
author: "sillycat"
date: "2020-03-31T23:18:39Z"
tags: []
categories: ["企业架构"]
slug: "docker-swarm-2020-2-docker-swarm-and-portainer"
draft: false
lastmod: "2020-03-31T23:18:39Z"
id: 2513336
url: "https://sillycat.iteye.com/blog/2513336"
---

Docker Swarm 2020(2)Docker Swarm and Portainer

Just follow my previous Portainer Installation, I have it running on the manager node
> ./portainer --template-file "/opt/portainer/templates.json" -p 0.0.0.0:9000 --data /opt/portainer/data

Portainer Swarm Cluster Endpoints

Just add the manage node 2375 into the Portainer
Login in to the UI Console and find the Swarm link in the menu  http://rancher-home:9000/#/swarm
We can find and go to the Swarm Visualizer http://rancher-home:9000/#/swarm/visualizer 
In Visualizer, we can see all the nodes and see what is running.

Create a new Service nginx
http://rancher-home:9000/#/services/new

Name: nginx3
Registry: DockerHub
Image: docker.io nginx:latest
Port mapping: host:8801 -> Container 80 TCP Ingress
Click Create Service

It runs on one node, because we choose Ingress, so we can visit it any nodes.
http://rancher-home:8801/
http://rancher-worker1:8801/
http://rancher-worker2:8801/

References:
https://www.jianshu.com/p/4d3de35f3a2d
https://www.jianshu.com/p/ed89aa65978f
https://dockerswarm.rocks/portainer/
https://zhuanlan.zhihu.com/p/106333254

