内容简介:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kongxx/article/details/86318664
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kongxx/article/details/86318664
使用 Portainer 管理 Docker Swarm 集群
- 关于怎样搭建使用Docker Swarm请参考 Docker使用Swarm组建集群
$ sudo docker pull portainer/portainer
创建 volume
为了保存 portainer 的数据,这里创建了一个 volume,如下:
$ sudo docker volume create portainer_data $ sudo docker volume ls DRIVER VOLUME NAME local portainer_data
启动 Portainer
注意:必须在 swarm 的 manager 节点运行。
$ sudo docker service create \ --name portainer \ --publish 9000:9000 \ --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://:9000 来验证之。
也可以在命令行通过 docker service 查看 portainer 服务。
$ sudo docker service ls ID NAME MODE REPLICAS IMAGE ge2nr7gnhlv2 portainer replicated 1/1 portainer/portainer:latest $ sudo docker service ps portainer ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS is6lpt326djg portainer.1 portainer/portainer:latest docker0 Running Running 20 seconds ago
启动服务
通过 portainer 服务。
通过 Stacks 启动
访问 “登录 portainer -> Stacks -> Add Stack -> Web editor”,然后输入下面内容并 “Deploy the stack”
version: '3.1'
services:
web:
image: nginx
deploy:
replicas: 2
ports:
- "8000:80"
restart: always
networks:
- myswarm
networks:
myswarm:
external: true
然后可以在 Stacks 和 Services 列表中查看。
通过 Services 启动
填表并创建 :smiley: 然后可以在 Services 列表中查看。
以上所述就是小编给大家介绍的《使用 Portainer 管理 Docker Swarm 集群》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Programming Python
Mark Lutz / O'Reilly Media / 2006-8-30 / USD 59.99
Already the industry standard for Python users, "Programming Python" from O'Reilly just got even better. This third edition has been updated to reflect current best practices and the abundance of chan......一起来看看 《Programming Python》 这本书的介绍吧!