使用图形化工具管理“失控”的镜像:Portainer


随着本地镜像的越来越多,如何管理就成了大麻烦

相关的管理工具也应运而生

Portainer就是其中的一款

下载

docker pull registry.cn-hangzhou.aliyuncs.com/sherry/portainer:latest

单机模式

  • 创建数据卷

docker volume create portainer-data

  • 运行容器
docker run -d -p 9000:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer-data:/data \
registry.cn-hangzhou.aliyuncs.com/sherry/portainer:latest

http://ip:9000

在此页面中设置好admin的密码 如:11111111

输入合法的密码之后

单机版选项红框标注

如图,已经可以通过Web的形式监控宿主机上的docker运行情况了

集群模式

Portainer对docker集群的管理依赖于swarm,所以首先要做的就是安装swarm,这里就不赘述了

$ 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

猜你喜欢

转载自blog.csdn.net/m0_37208669/article/details/84773556