您好,登录后才能下订单哦!
1、初始化manager节点(xxx为manager的ip地址)
docker swarm init --advertise-addr xxx.xxx.xxx.xxx
会输出以下内容,注意加粗斜体命令,加入集群需要使用
Swarm initialized: current node (pk4p936t4e03cpse3izuws07s) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token xxx xxx.xxx.xxx.xxx:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
2、worker加入集群,在其他docker服务器运行上面命令
docker swarm join --token xxx xxx.xxx.xxx.xxx:2377
3、查看集群情况
docker node ls
1、创建portainer-stack.yml文件
version: '3'
services:
portainer:
image: portainer/portainer
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/data/portainer:/data"
deploy:
placement:
constraints: [node.role == manager] # 控制管理界面部署在manager上
replicas: 1
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.2"
memory: 200M
labels: [svc=portainer]
ports:
- 9000:9000
2、启动portainer服务
docker stack deploy -c portainer-stack.yml portainer
3、访问portainer并修改密码(xxx为集群的任意一台ip,swarm会自动做负载均衡)
访问http://xxx.xxx.xxx.xxx:9000
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。