常用工具介绍
当 Docker 部署规模逐步变大后,可视化监控容器环境的性能和健康状态将会变得越来越
重要。 Docker的图形化管理工具,提供状态显示面板、应用模板快速部署、容器镜像网
络数据卷的基本操作(包括上传下载镜像,创建容器等操作)、事件日志显示、容器控
制台操作、Swarm集群和服务等集中管理和操作、登录用户管理和控制等功能。常用工
具如下:
1、docker UI(local)
2、shipyard(停止维护了)
3、portainer
4、daocloud
工具使用
安装shipyard
[root@iZbp143t3oxhfc3ar7jey0Z _data]# wget https://raw.githubusercontent.com/shipyard/shipyard-project.com/master/site/themes/shipyard/static/deploy --2020-03-19 22:25:18-- https://raw.githubusercontent.com/shipyard/shipyard-project.com/master/site/themes/shipyard/static/deploy Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.108.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.108.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 10119 (9.9K) [text/plain] Saving to: ‘deploy’ 100%[==============================================================================================================================>] 10,119 2.86KB/s in 3.5s 2020-03-19 22:25:37 (2.86 KB/s) - ‘deploy’ saved [10119/10119] [root@iZbp143t3oxhfc3ar7jey0Z _data]# ll total 12 -rw-r--r-- 1 root root 10119 Mar 19 22:25 deploy [root@iZbp143t3oxhfc3ar7jey0Z _data]# chmod +x deploy [root@iZbp143t3oxhfc3ar7jey0Z _data]# lsof -i:8080 [root@iZbp143t3oxhfc3ar7jey0Z _data]# bash deploy Unable to find image \'alpine:latest\' locally Trying to pull repository docker.io/library/alpine ... latest: Pulling from docker.io/library/alpine c9b1b535fdd9: Pulling fs layer c9b1b535fdd9: Verifying Checksum c9b1b535fdd9: Download complete c9b1b535fdd9: Pull complete Digest: sha256:ab00606a42621fb68f2ed6ad3c88be54397f981a7b70a79db3d1172b11c4367d Status: Downloaded newer image for docker.io/alpine:latest Deploying Shipyard -> Starting Database Unable to find image \'rethinkdb:latest\' locally Trying to pull repository docker.io/library/rethinkdb ... latest: Pulling from docker.io/library/rethinkdb 423ae2b273f4: Pulling fs layer de83a2304fa1: Pulling fs layer f9a83bce3af0: Pulling fs layer b6b53be908de: Pulling fs layer 3ac83ef15cd9: Pulling fs layer c2ab120993d1: Pulling fs layer 95f20c80c132: Pulling fs layer ccd905e123b4: Pulling fs layer b6b53be908de: Waiting 3ac83ef15cd9: Waiting c2ab120993d1: Waiting 95f20c80c132: Waiting ccd905e123b4: Waiting f9a83bce3af0: Verifying Checksum f9a83bce3af0: Download complete de83a2304fa1: Download complete b6b53be908de: Verifying Checksum b6b53be908de: Download complete c2ab120993d1: Verifying Checksum c2ab120993d1: Download complete 3ac83ef15cd9: Verifying Checksum 3ac83ef15cd9: Download complete ccd905e123b4: Verifying Checksum ccd905e123b4: Download complete 423ae2b273f4: Download complete 95f20c80c132: Verifying Checksum 95f20c80c132: Download complete 423ae2b273f4: Pull complete de83a2304fa1: Pull complete f9a83bce3af0: Pull complete b6b53be908de: Pull complete 3ac83ef15cd9: Pull complete c2ab120993d1: Pull complete 95f20c80c132: Pull complete ccd905e123b4: Pull complete Digest: sha256:27f36a2694b134c015fee951e2c8154d91c53252473a15c0d3a47f59873ffa64 Status: Downloaded newer image for docker.io/rethinkdb:latest -> Starting Discovery Unable to find image \'microbox/etcd:latest\' locally Trying to pull repository docker.io/microbox/etcd ... latest: Pulling from docker.io/microbox/etcd 8ded6e8ab3fd: Pulling fs layer bf8f85223d7a: Pulling fs layer a3ed95caeb02: Pulling fs layer a3ed95caeb02: Verifying Checksum a3ed95caeb02: Download complete 8ded6e8ab3fd: Verifying Checksum 8ded6e8ab3fd: Download complete bf8f85223d7a: Verifying Checksum bf8f85223d7a: Download complete 8ded6e8ab3fd: Pull complete bf8f85223d7a: Pull complete a3ed95caeb02: Pull complete Digest: sha256:941fd46b4eab265c65da9bfbf33397b853a7cef6c16df93a1e3fea7b4e47fc90 Status: Downloaded newer image for docker.io/microbox/etcd:latest -> Starting Cert Volume -> Starting Proxy Unable to find image \'shipyard/docker-proxy:latest\' locally Trying to pull repository docker.io/shipyard/docker-proxy ... latest: Pulling from docker.io/shipyard/docker-proxy 8f4ec95ceaee: Pulling fs layer ac77a345f217: Pulling fs layer 43039e3ef672: Pulling fs layer a3ed95caeb02: Pulling fs layer a3ed95caeb02: Waiting 43039e3ef672: Verifying Checksum 43039e3ef672: Download complete a3ed95caeb02: Verifying Checksum a3ed95caeb02: Download complete ac77a345f217: Verifying Checksum ac77a345f217: Download complete 8f4ec95ceaee: Verifying Checksum 8f4ec95ceaee: Download complete 8f4ec95ceaee: Pull complete ac77a345f217: Pull complete 43039e3ef672: Pull complete a3ed95caeb02: Pull complete Digest: sha256:da6bbd1a145581a940d44940cce0f43705d7f8ec552a4e97e77104ec1b6dc3d1 Status: Downloaded newer image for docker.io/shipyard/docker-proxy:latest -> Starting Swarm Manager Unable to find image \'swarm:latest\' locally Trying to pull repository docker.io/library/swarm ... latest: Pulling from docker.io/library/swarm d85c18077b82: Pulling fs layer 1e6bb16f8cb1: Pulling fs layer 85bac13497d7: Pulling fs layer 85bac13497d7: Verifying Checksum 85bac13497d7: Download complete 1e6bb16f8cb1: Verifying Checksum 1e6bb16f8cb1: Download complete d85c18077b82: Verifying Checksum d85c18077b82: Download complete d85c18077b82: Pull complete 1e6bb16f8cb1: Pull complete 85bac13497d7: Pull complete Digest: sha256:b866583a3b8791bcd705b7bc0fd94c66b695a1a2dbaeb5f59ed29940e5015dc8 Status: Downloaded newer image for docker.io/swarm:latest -> Starting Swarm Agent -> Starting Controller Unable to find image \'shipyard/shipyard:latest\' locally Trying to pull repository docker.io/shipyard/shipyard ... latest: Pulling from docker.io/shipyard/shipyard cb5507795515: Pulling fs layer fd711d385b34: Pulling fs layer 9f2a509de079: Pulling fs layer a5251eb716bb: Pulling fs layer a5251eb716bb: Waiting cb5507795515: Verifying Checksum cb5507795515: Download complete cb5507795515: Pull complete fd711d385b34: Verifying Checksum fd711d385b34: Download complete 9f2a509de079: Verifying Checksum 9f2a509de079: Download complete fd711d385b34: Pull complete a5251eb716bb: Verifying Checksum a5251eb716bb: Download complete 9f2a509de079: Pull complete a5251eb716bb: Pull complete Digest: sha256:5f065362680fa4565dd150c8da3edd09b79a7a3010d3ceef20093c2a879187e0 Status: Downloaded newer image for docker.io/shipyard/shipyard:latest Waiting for Shipyard on 172.16.123.210:8080 Shipyard available at http://172.16.123.210:8080 Username: admin Password: shipyard [root@iZbp143t3oxhfc3ar7jey0Z _data]#
用户名和密码:Username: admin Password: shipyard
优点
1.支持镜像管理、容器管理。
2.支持控制台命令
3.容器资源消耗监控
4.支持集群swarm,可以随意增加节点
5.支持控制用户管理权限,可以设置某个容器对某个用户只读、管理权限。
6.有汉化版
缺点
1.启动容器较多,占用每个节点的一部分资源
2.兼容性性不高,可能是我自身原因,经常打不开首页。
安装docker UI
[root@iZbp143t3oxhfc3ar7jey0Z run]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/nginx latest a1523e859360 3 weeks ago 127 MB docker.io/sonatype/nexus pro-2.14.16 f27405473ed3 2 months ago 482 MB quay.azk8s.cn/kubernetes-ingress-controller/nginx-ingress-controller 0.24.1 98675eb54d0e 11 months ago 631 MB quay.io/kubernetes-ingress-controller/nginx-ingress-controller 0.24.1 98675eb54d0e 11 months ago 631 MB docker.io/jpetazzo/nsenter latest 4167ddcfcec6 13 months ago 375 MB quay.io/coreos/flannel v0.11.0-amd64 ff281650a721 13 months ago 52.6 MB quay.azk8s.cn/coreos/flannel v0.11.0-amd64 ff281650a721 13 months ago 52.6 MB docker.io/elasticsearch latest 5acf0e8da90b 18 months ago 486 MB gcr.azk8s.cn/google_containers/pause-amd64 3.1 da86e6ba6ca1 2 years ago 742 kB k8s.gcr.io/pause-amd64 3.1 da86e6ba6ca1 2 years ago 742 kB docker.io/containerize/elastichd latest c2202f76db37 2 years ago 28.1 MB docker.io/mobz/elasticsearch-head 5 b19a5c98e43b 3 years ago 824 MB docker.io/uifd/ui-for-docker latest 965940f98fa5 3 years ago 8.1 MB [root@iZbp143t3oxhfc3ar7jey0Z run]# docker run -it -d --name docker-web -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock docker.io/uifd/ui-for-docker 70784406d6d0775d7eff990cbbb700281c64f0ceeffc90013565d90292e7513d [root@iZbp143t3oxhfc3ar7jey0Z run]# lsof -i:9000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME docker-pr 8458 root 4u IPv6 102817 0t0 TCP *:cslistener (LISTEN) [root@iZbp143t3oxhfc3ar7jey0Z run]#
截图如下:
优点:
1.支持容器管理
2. 支持镜像管理
3.基于docker api,自身也是一个容器。
4.稳定性高
5.可动态显示显示容器之间关系图
6.容器管理,增加端口映射,增加系统变量、映射目录等
缺点:
1.没有登录验证,因为没有登录体系,目前解决办法是,只开放本地访问,或者通过TLS来对权限进行控制。
2.无法分配某容器给某用户。
3.不支持多主机。
4.不支持集群swarm等功能少
安装portainer
[root@iZbp143t3oxhfc3ar7jey0Z _data]# docker run -d -p 9001:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock --name prtainer-test portainer/portainer b03724c9f4ee670b91b76e87ea9ba528aa94b37eecdeec45a4a4dd9b503f450b [root@iZbp143t3oxhfc3ar7jey0Z _data]# docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b03724c9f4ee portainer/portainer "/portainer" 9 seconds ago Up 8 seconds 0.0.0.0:9001->9000/tcp prtainer-test [root@iZbp143t3oxhfc3ar7jey0Z _data]#
优点
1. 支持容器管理、镜像管理
2. 轻量级,消耗资源少
3. 基于docker api,安全性高,可指定docker api端口,支持TLS证书认证。
4. 支持权限分配
5. 支持集群
缺点
1. 功能不够强大。
2. 容器创建后,无法通过后台增加端口。
daocloud
要在官网注册一个账号,然后点击集群管理,添加主机
[root@iZbp143t3oxhfc3ar7jey0Z _data]# curl -sSL https://get.daocloud.io/daomonit/install.sh | sh -s eec86dcd4004fd5f01e78130d999e2ba26e7b9f6 * Installing Daomonit... * Downloading Daomonit from https://get.daocloud.io/daomonit/daomonit.x86_64.rpm % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 279 100 279 0 0 969 0 --:--:-- --:--:-- --:--:-- 972 100 337 100 337 0 0 73 0 0:00:04 0:00:04 --:--:-- 104 100 3349k 100 3349k 0 0 709k 0 0:00:04 0:00:04 --:--:-- 709k Preparing... ################################# [100%] Updating / installing... 1:daomonit-0.1.70-1 ################################# [100%] Created symlink from /etc/systemd/system/multi-user.target.wants/daomonit.service to /usr/lib/systemd/system/daomonit.service. * Configuring Daomonit... [03/19/20 22:16:58] [DEBG] Writing configuration file /etc/daocloud/daomonit.yml [03/19/20 22:16:58] [INFO] You have successfully saved your config file. * Start Daomonit... Starting daomonit (via systemctl): [ OK ] You can view daomonit log at /var/log/daomonit.log And You can Start or Stop daomonit with: service daomonit start/stop/restart/status ********************************************************************* ********************************************************************* *** *** Installed and Started Daomonit 0.1.70 *** *** NOTICE: *** You can pull image very Fast by dao, For Example: *** dao pull ubuntu *** ********************************************************************* ********************************************************************* [root@iZbp143t3oxhfc3ar7jey0Z _data]#
优点:
1. 支持镜像管理、容器管理。
2. 支持控制台命令
3. 容器资源消耗监控
4. 支持集群可以随意增加节点
5. 中文平台
6. 镜像下载
7. 容器扩容、管理
缺点
1. 管理平台无法部署到本地服务器
2. 部分高级功能收费