社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  docker

推荐一个命令行下交互式 Docker 容器管理工具 Dry

运维之美 • 5 年前 • 735 次点击  

什么是 Dry

Dry 是一个可管理并监控 Docker 容器和镜像的命令行工具,与 Docker 官方自带的命令行工具相比 Dry 提供了交互式操作界面。

Dry 可以更方便和直观的管理容器相关的信息,包括对应镜像、容器名称、网络、容器中运行的命令及容器状态。如果运行在 Docker Swarm 中,Dry 还会给出 Swarm 集群的各种状态信息。

Dry 不仅可以管理本地 Docker 守护进程,也可以管理远程的 Docker 守护进程。

  • 如果连接本地 Docker 守护进程,Docker 主机显示为 unix:///var/run/docker.sock

  • 如果连接远程 Docker 守护进程,Docker 主机显示为 tcp://IP Address:Port Numbertcp://Host Name:Port Number


项目官方地址:https://github.com/moncho/dry

安装 Dry

Dry 的安装非常简单,只需使用官方提供的脚本就可以很方便安装在对应的系统上。Dry 目前支持的操作系统有:macOS、Freebsd、Linux、Windows。

$ curl -sSf https://moncho.github.io/dry/dryup.sh | sudo sh
$ sudo chmod 755 /usr/local/bin/dry

除了使用预编译的二进制包安装外,官方还提供了多种多样的安装方式。比如:mac 下 可使用 brew 进行安装,Arch Linux 下可使用 yaourt 进行安装,具体可能参考官方文档。

运行 Dry

直接在命令行下输入 dry 命令,便可启动一个 Dry。 Dry 默认会连接本地的 Docker 守护进程:

$ dry

Dry 默认运行界面会显示容器的一些基本信息,与 docker ps 命令相比 Dry 体验上会更加友好。

Dry 快捷键列表

  • 全局命令

KeybindingDescription
%filter list
F1sort list
F5refresh list
F8show docker disk usage
F9show last 10 docker events
F10show docker info
1show container list
2show image list
3show network list
4show node list (on Swarm mode)
5show service list (on Swarm mode)
ArrowUpmove the cursor one line up
ArrowDownmove the cursor one line down
gmove the cursor to the top
Gmove the cursor to the bottom
qquit dry
  • 容器命令

KeybindingDescription
Entershow container command menu
F2toggle on/off showing stopped containers
iinspect
lcontainer logs
eremove
sstats
Ctrl+eremove all stopped containers
Ctrl+kkill
Ctrl+rstart/restart
Ctrl+tstop
  • 镜像命令

KeybindingDescription
ihistory
rrun command in new container
Ctrl+dremove dangling images
Ctrl+eremove image
Ctrl+fremove image (force)
Enterinspect
  • 网络命令

KeybindingDescription
Ctrl+eremove network
Enterinspect
  • 服务命令

KeybindingDescription
iinspect service
lservice logs
Ctrl+rremove service
Ctrl+sscale service
Entershow service tasks
  • 缓冲区操作命令

KeybindingDescription
ArrowUpmove the cursor one line up
ArrowDownmove the cursor one line down
gmove the cursor to the beginning of the buffer
Gmove the cursor to the end of the buffer
n after search, move forwards to the next search hit
Nafter search, move backwards to the previous search hit
ssearch
pg upmove the cursor “screen size” lines up
pg downmove the cursor “screen size” lines down

监控 Docker 容器

在 Dry 的运行界面中按下 m 键即可打开监控模式,与 docker stats 命令相比 Dry 具有更加详细并且彩色的输出。Dry 还有一个额外的 NAME 列,方便你很容易的区分容器。

管理 Docker 容器

如果你在 Dry 主界面选中的容器上单击回车键,你就可以管理该容器。Dry 对容器管理提供了查看日志、查看/杀死/删除容器、停止/启动/重启容器、查看容器状态及镜像历史记录等操作。



  • 查看全部 Docker 容器

在 Dry 主界面按下 F2 键即可列出全部容器,包括运行中和已关闭的容器。



  • 监控容器资源利用率

在容器管理界面,点击 Stats+Top 选项查看指定容器的资源利用率。你也可以按下快捷键 s 来打开容器资源利用率界面。





  • 查看容器、镜像及本地卷的磁盘使用情况

在 Dry 主界面按下 F8 键即可查看容器、镜像及本地卷的磁盘使用情况。该界面明确地给出容器、镜像和卷的总数,哪些处于使用状态,以及整体磁盘使用情况、可回收空间大小的详细信息。

管理 Docker 容器镜像

在 Dry 主界面中按下 2 键即可列出全部的已下载镜像。

如果你想删除一个镜像,只需从界面中选择它,然后按 Ctrl + E。对于强制删除,你可以使用 Ctrl + F

查看 Docker 网络列表

在 Dry 主界面按下 3 键即可查看全部网络及网关。

其它操作

  • 如果你在使用中需要更多帮助,可按下 H 键查询帮助来获得更详细的使用说明。

  • 如果你需要对列表项目进行排序,可按下 F1 键来实现。

  • Dry 也支持 Docker 的 Services、Stacks 管理,你可以在 Dry 主界面中按下 5 键或 6 键切换到相应管理界面。

参考文档

http://www.google.com
https://github.com/moncho/dry
https://linux.cn/article-9615-1.html
https://hackernoon.com/docker-cli-alternative-dry-5e0b0839b3b8


今日思想


如果不是出身富贵家庭,忠诚和勤奋是你成就事业的唯一机会。


—— 雷军




更多精彩热文:




如果你觉得内容很赞,还等什么?快快长按打赏吧,iOS的土豪们也是可以的哟!







今天看啥 - 高品质阅读平台
本文地址:http://www.jintiankansha.me/t/rudgbLzPzg
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/12833
 
735 次点击