mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-29 21:41:00 +08:00
Merge pull request #8559 from pinewall/submit-tech20180320
submit tech/20180320 Dry - An Interactive CLI Manager For Docker Containers.md
This commit is contained in:
commit
73d29247ac
@ -1,155 +0,0 @@
|
||||
pinewall translating
|
||||
|
||||
Dry – An Interactive CLI Manager For Docker Containers
|
||||
======
|
||||
Docker is a software that allows operating-system-level virtualization also known as containerization.
|
||||
|
||||
It uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and others to allows independent containers to run within a single Linux instance.
|
||||
|
||||
Docker provides a way to run applications securely isolated in a container, packaged with all its dependencies and libraries.
|
||||
|
||||
### What Is Dry
|
||||
|
||||
[Dry][1] is a command line utility to manage & monitor Docker containers and images.
|
||||
|
||||
It shows information about Containers, Images, Name of the containers, Networks, Running commands in the containers, and status, and, if running a Docker Swarm, it also shows all kinds of information about the state of the Swarm cluster.
|
||||
|
||||
It can connect to both local or remote Docker daemons. Docker host shows `unix:///var/run/docker.sock` if the local Docker connected.
|
||||
|
||||
Docker host shows `tcp://IP Address:Port Number` or `tcp://Host Name:Port Number` if the remote Docker connected.
|
||||
|
||||
It could provide you the similar output metrics like `docker ps` but it has more verbose and colored output than “docker ps”.
|
||||
|
||||
It also has an additional NAME column which comes handy at times when you have many containers you are not a memory champion.
|
||||
|
||||
**Suggested Read :**
|
||||
**(#)** [Portainer – A Simple Docker Management GUI][2]
|
||||
**(#)** [Rancher – A Complete Container Management Platform For Production Environment][3]
|
||||
**(#)** [cTop – A Command-Line Tool For Container Monitoring And Management In Linux][4]
|
||||
|
||||
### How To Install Dry On Linux
|
||||
|
||||
The latest dry utility can be installed through single shell script on Linux. It does not require external libraries. Most of the Docker commands are available in dry with the same behavior.
|
||||
```
|
||||
$ curl -sSf https://moncho.github.io/dry/dryup.sh | sudo sh
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
Dload Upload Total Spent Left Speed
|
||||
100 10 100 10 0 0 35 0 --:--:-- --:--:-- --:--:-- 35
|
||||
dryup: downloading dry binary
|
||||
######################################################################## 100.0%
|
||||
dryup: Moving dry binary to its destination
|
||||
dryup: dry binary was copied to /usr/local/bin, now you should 'sudo chmod 755 /usr/local/bin/dry'
|
||||
|
||||
```
|
||||
|
||||
Change the file permission to `755` using the below command.
|
||||
```
|
||||
$ sudo chmod 755 /usr/local/bin/dry
|
||||
|
||||
```
|
||||
|
||||
For Arch Linux users can install from AUR repository with help of **[Packer][5]** or **[Yaourt][6]** package manager.
|
||||
```
|
||||
$ yaourt -S dry-bin
|
||||
or
|
||||
$ packer -S dry-bin
|
||||
|
||||
```
|
||||
|
||||
If you wants to run dry as a Docker container, run the following command. Make sure Docker should be installed on your system for this as a prerequisites.
|
||||
|
||||
**Suggested Read :**
|
||||
**(#)** [How to install Docker in Linux][7]
|
||||
**(#)** [How to play with Docker images on Linux][8]
|
||||
**(#)** [How to play with Docker containers on Linux][9]
|
||||
**(#)** [How to Install, Run Applications inside Docker Containers][10]
|
||||
```
|
||||
$ docker run -it -v /var/run/docker.sock:/var/run/docker.sock moncho/dry
|
||||
|
||||
```
|
||||
|
||||
### How To Launch & Use Dry
|
||||
|
||||
Simply run the `dry` command from your terminal to launch the utility. The default output for dry is similar to below.
|
||||
```
|
||||
$ dry
|
||||
|
||||
```
|
||||
|
||||
![][12]
|
||||
|
||||
### How To Monitor Docker Using Dry
|
||||
|
||||
You can open the monitor mode in dry by pressing `m` key.
|
||||
![][13]
|
||||
|
||||
### How To Manage Container Using Dry
|
||||
|
||||
To monitor any containers, just hit `Enter` on that. Dry allows you to perform activity such as logs, inspect, kill, remove container, stop, start, restart, stats, and image history.
|
||||
![][14]
|
||||
|
||||
### How To Monitor Container Resource Utilization
|
||||
|
||||
Dry allows users to monitor particular container resource utilization using `Stats+Top` option.
|
||||
|
||||
We can achieve this by navigating to container management page (Follow the above steps and hit the `Stats+Top` option). Alternatively we can press `s` key to open container resource utilization page.
|
||||
|
||||
![][15]
|
||||
|
||||
### How To Check Container, Image, & Local Volume Disk Usage
|
||||
|
||||
We can check disk usage of containers, images, and local volumes using `F8` key.
|
||||
|
||||
This will clearly display the total number of containers, images, and volumes, and how many are active, and total disk usage and reclaimable size details.
|
||||
![][16]
|
||||
|
||||
### How To Check Downloaded Images
|
||||
|
||||
Press `2` key to list all the downloaded images.
|
||||
![][17]
|
||||
|
||||
### How To Show Network List
|
||||
|
||||
Press `3` key to list all the networks and it’s gateway.
|
||||
![][18]
|
||||
|
||||
### How To List All Docker Containers
|
||||
|
||||
Press `F2` key to list all the containers (This output includes Running & Stopped containers).
|
||||
![][19]
|
||||
|
||||
### Dry Keybinds
|
||||
|
||||
To view keybinds, navigate to help page or [dry github][1] page.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/dry-an-interactive-cli-manager-for-docker-containers/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.2daygeek.com/author/magesh/
|
||||
[1]:https://github.com/moncho/dry
|
||||
[2]:https://www.2daygeek.com/portainer-a-simple-docker-management-gui/
|
||||
[3]:https://www.2daygeek.com/rancher-a-complete-container-management-platform-for-production-environment/
|
||||
[4]:https://www.2daygeek.com/ctop-a-command-line-tool-for-container-monitoring-and-management-in-linux/
|
||||
[5]:https://www.2daygeek.com/install-packer-aur-helper-on-arch-linux/
|
||||
[6]:https://www.2daygeek.com/install-yaourt-aur-helper-on-arch-linux/
|
||||
[7]:https://www.2daygeek.com/install-docker-on-centos-rhel-fedora-ubuntu-debian-oracle-archi-scentific-linux-mint-opensuse/
|
||||
[8]:https://www.2daygeek.com/list-search-pull-download-remove-docker-images-on-linux/
|
||||
[9]:https://www.2daygeek.com/create-run-list-start-stop-attach-delete-interactive-daemonized-docker-containers-on-linux/
|
||||
[10]:https://www.2daygeek.com/install-run-applications-inside-docker-containers/
|
||||
[11]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[12]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-1.png
|
||||
[13]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-2.png
|
||||
[14]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-3.png
|
||||
[15]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-4.png
|
||||
[16]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-5.png
|
||||
[17]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-6.png
|
||||
[18]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-7.png
|
||||
[19]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-8.png
|
@ -0,0 +1,154 @@
|
||||
Dry – 一个命令行交互式 Docker 容器管理器
|
||||
======
|
||||
Docker 是一种实现操作系统级别虚拟化或容器化的软件。
|
||||
|
||||
基于 Linux 内核的 cgroups 和 namespaces 等资源隔离特性,Docker 可以在单个 Linux 实例中运行多个独立的容器。
|
||||
|
||||
通过将应用依赖和相关库打包进容器,Docker 使得应用可以在容器中安全隔离地运行。
|
||||
|
||||
### Dry 是什么
|
||||
|
||||
[Dry][1] 是一个管理并监控 Docker 容器和镜像的命令行工具。
|
||||
|
||||
Dry 给出容器相关的信息,包括对应镜像、容器名称、网络、容器中运行的命令及容器状态;如果运行在 Docker Swarm 中,工具还会给出 Swarm 集群的各种状态信息。
|
||||
|
||||
Dry 可以连接至本地或远程的 Docker 守护进程。如果连接本地 Docker,Docker 主机显示为`unix:///var/run/docker.sock`。
|
||||
|
||||
如果连接远程 Docker,Docker 主机显示为 `tcp://IP Address:Port Number` 或 `tcp://Host Name:Port Number`。
|
||||
|
||||
Dry 可以提供类似 `docker ps` 的指标输出,但输出比 “docker ps” 内容详实、富有色彩。
|
||||
|
||||
相比 Docker,Dry 还可以手动添加一个额外的名称列,用于降低记忆难度。
|
||||
|
||||
***推荐阅读:**
|
||||
|
||||
**(#)** [Portainer – 用于 Docker 管理的简明 GUI][2]
|
||||
**(#)** [Rancher – 适用于生产环境的完备容器管理平台][3]
|
||||
**(#)** [cTop – Linux环境下容器管理与监控的命令行工具][4]
|
||||
|
||||
### 如何在 Linux 中安装 Dry
|
||||
|
||||
在 Linux 中,可以通过一个简单的 shell 脚本安装最新版本的 dry 工具。Dry 不依赖外部库。对于绝大多数的 Docker 命令,dry 提供类似样式的命令。
|
||||
```
|
||||
$ curl -sSf https://moncho.github.io/dry/dryup.sh | sudo sh
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
Dload Upload Total Spent Left Speed
|
||||
100 10 100 10 0 0 35 0 --:--:-- --:--:-- --:--:-- 35
|
||||
dryup: downloading dry binary
|
||||
######################################################################## 100.0%
|
||||
dryup: Moving dry binary to its destination
|
||||
dryup: dry binary was copied to /usr/local/bin, now you should 'sudo chmod 755 /usr/local/bin/dry'
|
||||
|
||||
```
|
||||
|
||||
使用如下命令将文件权限变更为 `755`
|
||||
```
|
||||
$ sudo chmod 755 /usr/local/bin/dry
|
||||
|
||||
```
|
||||
|
||||
对于使用 Arch Linux 的用户,可以使用 **[Packer][5]** or **[Yaourt][6]** 包管理器,从 AUR 源安装该工具。
|
||||
```
|
||||
$ yaourt -S dry-bin
|
||||
或者
|
||||
$ packer -S dry-bin
|
||||
|
||||
```
|
||||
|
||||
如果希望在 Docker 容器中运行 dry,可以运行如下命令。前提条件是已确认在操作系统中安装了 Docker。
|
||||
|
||||
**推荐阅读:**
|
||||
**(#)** [如何在 Linux 中安装 Docker][7]
|
||||
**(#)** [如何在 Linux 中玩转 Docker 镜像][8]
|
||||
**(#)** [如何在 Linux 中玩转 Docker 容器][9]
|
||||
**(#)** [如何在 Docker 容器中安装并运行应用程序][10]
|
||||
```
|
||||
$ docker run -it -v /var/run/docker.sock:/var/run/docker.sock moncho/dry
|
||||
|
||||
```
|
||||
|
||||
### 如何启动并运行 Dry
|
||||
|
||||
在控制台运行 `dry` 命令即可启动该工具,其默认输出如下:
|
||||
```
|
||||
$ dry
|
||||
|
||||
```
|
||||
|
||||
![][12]
|
||||
|
||||
### 如何使用 Dry 监控 Docker
|
||||
|
||||
你可以在 dry 的界面中按下 `m` 键打开监控模式。
|
||||
![][13]
|
||||
|
||||
### 如何使用 Dry 管理容器
|
||||
|
||||
在选中的容器上单击 `Enter` 键,即可管理容器。Dry 提供如下操作:查看日志,查看、杀死、删除容器,停止、启动、重启容器,查看容器状态及镜像历史记录等。
|
||||
![][14]
|
||||
|
||||
### 如何监控容器资源利用率
|
||||
|
||||
用户可以使用 `Stats+Top` 选项查看指定容器的资源利用率。
|
||||
|
||||
该操作需要在容器管理界面完成(在上一步的基础上,点击 `Stats+Top` 选项)。另外,也可以按下 `s` 打开容器资源利用率界面。
|
||||
|
||||
![][15]
|
||||
|
||||
### 如何查看容器、镜像及本地卷的磁盘使用情况
|
||||
|
||||
可以使用 `F8` 键查看容器、镜像及本地卷的磁盘使用情况。
|
||||
|
||||
该界面明确地给出容器、镜像和卷的总数,哪些处于使用状态,以及整体磁盘使用情况、可回收空间大小的详细信息。
|
||||
![][16]
|
||||
|
||||
### 如何查看已下载的镜像
|
||||
|
||||
按下 `2` 键即可列出全部的已下载镜像。
|
||||
![][17]
|
||||
|
||||
### 如何查看网络列表
|
||||
|
||||
按下 `3` 键即可查看全部网络及网关。
|
||||
![][18]
|
||||
|
||||
### 如何查看全部 Docker 容器
|
||||
|
||||
按下 `F2` 键即可列出列出全部容器,包括运行中和已关闭的容器。
|
||||
![][19]
|
||||
|
||||
### Dry 快捷键
|
||||
|
||||
查看帮助页面或 [dry github][1] 即可查看全部快捷键。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/dry-an-interactive-cli-manager-for-docker-containers/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
译者:[pinewall](https://github.com/pinewall)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.2daygeek.com/author/magesh/
|
||||
[1]:https://github.com/moncho/dry
|
||||
[2]:https://www.2daygeek.com/portainer-a-simple-docker-management-gui/
|
||||
[3]:https://www.2daygeek.com/rancher-a-complete-container-management-platform-for-production-environment/
|
||||
[4]:https://www.2daygeek.com/ctop-a-command-line-tool-for-container-monitoring-and-management-in-linux/
|
||||
[5]:https://www.2daygeek.com/install-packer-aur-helper-on-arch-linux/
|
||||
[6]:https://www.2daygeek.com/install-yaourt-aur-helper-on-arch-linux/
|
||||
[7]:https://www.2daygeek.com/install-docker-on-centos-rhel-fedora-ubuntu-debian-oracle-archi-scentific-linux-mint-opensuse/
|
||||
[8]:https://www.2daygeek.com/list-search-pull-download-remove-docker-images-on-linux/
|
||||
[9]:https://www.2daygeek.com/create-run-list-start-stop-attach-delete-interactive-daemonized-docker-containers-on-linux/
|
||||
[10]:https://www.2daygeek.com/install-run-applications-inside-docker-containers/
|
||||
[11]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[12]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-1.png
|
||||
[13]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-2.png
|
||||
[14]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-3.png
|
||||
[15]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-4.png
|
||||
[16]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-5.png
|
||||
[17]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-6.png
|
||||
[18]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-7.png
|
||||
[19]:https://www.2daygeek.com/wp-content/uploads/2018/03/dry-an-interactive-cli-manager-for-docker-containers-8.png
|
Loading…
Reference in New Issue
Block a user