安裝 docker swarm :https://www.cnblogs.com/klvchen/p/9437758.html
portainer 集群啟動
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
登錄 http://ip:9000 設置密碼
添加 docker swarm 中的其他成員
# 在其他成員機器上安裝代理
docker run -ti -d -p 2375:2375 \
--restart=always \
--hostname=$HOSTNAME \
--name shipyard-proxy \
-v /var/run/docker.sock:/var/run/docker.sock \
-e PORT=2375 \
shipyard/docker-proxy
在 Portainer 上進行添加
可以在 Portainer 上進行切換,管理節點成員
參考官方文檔:https://portainer.io/install.html
portainer 單機啟動:
docker run -d -p 9000:9000 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
portainer/portainer