天天看點

【4.1】伺服器安裝 Docker Swarm中搭建 Portainer

​​https://documentation.portainer.io/v2.0/deploy/ceinstallswarm/​​

105 上執行

​docker swarm init​

【4.1】伺服器安裝 Docker Swarm中搭建 Portainer

image.png

103 上執行

​docker swarm join --token SWMTKN-1-1lobxni2wtms2oeunf5f0iz20x5ztc639q24c1zvd73iz9kem1-dt8gegyqi0ani4emj20v9iwis 192.168.0.105:2377​

【4.1】伺服器安裝 Docker Swarm中搭建 Portainer

image.png

如果忘記了使用token 使用 ​

​docker swarm join-token​

添加新節點角色為 worker ​

​docker swarm join-token worker​

添加新節點角色為 manager​

​docker swarm join-token manager​

105 上執行

docker volume create portainer_data
docker service create \
--name portainer \
--publish 9000:9000 \
--replicas=1 \
--constraint 'node.role == manager' \
--mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \
--mount type=volume,src=portainer_data,dst=/data \
portainer/portainer \
-H unix:///var/run/docker.sock      

103

編輯docker檔案:/usr/lib/systemd/system/docker.service,在ExecStart=這一行加上端口映射:-H tcp://0.0.0.0:2375。

vi /usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -H fd:// --containerd=/run/containerd/containerd.sock


systemctl daemon-reload 

systemctl restart docker      

通路

http://192.168.0.105:9000

【4.1】伺服器安裝 Docker Swarm中搭建 Portainer

image.png

【4.1】伺服器安裝 Docker Swarm中搭建 Portainer

image.png

【4.1】伺服器安裝 Docker Swarm中搭建 Portainer

image.png

docker swarm CA憑證到期

docker system info
docker swarm update --cert-expiry 867240h0m0s
docker swarm ca --rotate | openssl x509 -text -noout
docker system info