translated

This commit is contained in:
geekpi 2019-05-29 11:05:02 +08:00
parent cb57ab1099
commit 2108ba4b63
2 changed files with 162 additions and 162 deletions

View File

@ -1,162 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Dockly Manage Docker Containers From Terminal)
[#]: via: (https://www.ostechnix.com/dockly-manage-docker-containers-from-terminal/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Dockly Manage Docker Containers From Terminal
======
![][1]
A few days ago, we published a guide which covered almost all details you ever need to know to [**getting started with Docker**][2]. In that guide, we have shown you how to create and manage Docker containers in detail. There are also some non-official tools available for managing Docker containers. If youve looked at our old archives, you might have stumbled upon two web-based tools namely [**“Portainer”**][3] and [**“PiCluster”**][4]. Both of them makes the Docker management task much easier and simpler from a web browser. Today, I came across yet another Docker management tool named **“Dockly”**.
Unlike the aforementioned tools, Dockly is a TUI (text user interface) utility to manage Docker containers and services from the Terminal in Unix-like systems. It is free, open source tool built with **NodeJS**. In this brief guide, we will see how to install Dockly and how to manage Docker containers from command line.
### Installing Dockly
Make sure you have installed NodeJS on your Linux box. If you havent installed it yet, refer the following guide.
* [**How To Install NodeJS On Linux**][5]
Once NodeJS is installed, run the following command to install Dockly:
```
# npm install -g dockly
```
### Manage Docker Containers With Dockly From Terminal
Managing Docker containers with Dockly is easy! All you have to do is to open the terminal and run the following command:
```
# dockly
```
Dockly will will automatically connect to your localhost docker daemon through the unix socket and display the list of running containers in the Terminal as shown below.
![][6]
Manage Docker Containers Using Dockly
As you can see in the above screenshot, Dockly displays the following information of running containers on the top:
* Container ID,
* Name of the container(s),
* Docker image,
* Command,
* State of the running container(s),
* Status.
On the top right side, you will see the CPU an Memory utilization of containers. Use UP/DOWN arrow keys to move between Containers.
At the bottom, there are few keyboard shortcut keys to do various docker management tasks. Here are the list of currently available keyboard shortcuts:
* **=** Refresh the Dockly interface,
* **/** Search the containers list view,
* **i** Display the information about the currently selected container or service,
* **< RETURN>** Show logs of the current container or service,
* **v** Toggle between Containers and Services view,
* **l** Launch a /bin/bash session on the selected Container,
* **r** Restart the selected Container,
* **s** Stop the selected Container,
* **h** Show HELP window,
* **q** Quit Dockly.
##### **Viewing information of a container**
Choose a Container using UP/DOWN arrow and press **“i”** to display the information of the selected Container.
![][7]
View containers information
##### Restart Containers
If you want to restart your Containers at any time, just choose it and press **“r”** to restart.
![][8]
Restart Docker containers
##### Stop/Remove Containers and Images
We can stop and/or remove one or all containers at once if they are no longer required. To do so, press **“m”** to open **Menu**.
![][9]
Stop, remove Docker containers and images
From here, you can do the following operations.
* Stop all Docker containers,
* Remove selected container,
* Remove all containers,
* Remove all Docker images etc.
##### Display Dockly help section
If you have any questions, just press **“h”** to open the help section.
![][10]
Dockly Help
For more details, refer the official GitHub page given at the end.
And, thats all for now. Hope this was useful. If you spend a lot of time working with Docker containers, give Dockly a try and see if it helps.
* * *
**Suggested read:**
* **[How To Automatically Update Running Docker Containers][11]**
* [**ctop A Commandline Monitoring Tool For Linux Containers**][12]
* * *
**Resource:**
* [**Dockly GitHub Repository**][13]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/dockly-manage-docker-containers-from-terminal/
作者:[sk][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2019/05/Dockly-720x340.png
[2]: https://www.ostechnix.com/getting-started-with-docker/
[3]: https://www.ostechnix.com/portainer-an-easiest-way-to-manage-docker/
[4]: https://www.ostechnix.com/picluster-simple-web-based-docker-management-application/
[5]: https://www.ostechnix.com/install-node-js-linux/
[6]: http://www.ostechnix.com/wp-content/uploads/2019/05/Manage-Docker-Containers-Using-Dockly.png
[7]: http://www.ostechnix.com/wp-content/uploads/2019/05/View-containers-information.png
[8]: http://www.ostechnix.com/wp-content/uploads/2019/05/Restart-containers.png
[9]: http://www.ostechnix.com/wp-content/uploads/2019/05/stop-remove-containers-and-images.png
[10]: http://www.ostechnix.com/wp-content/uploads/2019/05/Dockly-Help.png
[11]: https://www.ostechnix.com/automatically-update-running-docker-containers/
[12]: https://www.ostechnix.com/ctop-commandline-monitoring-tool-linux-containers/
[13]: https://github.com/lirantal/dockly

View File

@ -0,0 +1,162 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Dockly Manage Docker Containers From Terminal)
[#]: via: (https://www.ostechnix.com/dockly-manage-docker-containers-from-terminal/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Dockly - 从终端管理 Docker 容器
======
![][1]
几天前,我们发布了一篇指南,其中涵盖了[**开始使用 Docker**][2] 时需要了解的几乎所有细节。在该指南中,我们向你展示了如何详细创建和管理 Docker 容器。还有一些非官方工具可用于管理 Docker 容器。如果你看过我们以前的文字,你可能会看到两个基于网络的工具,[**“Portainer”**][3] 和 [**“PiCluster”**][4]。它们都使得 Docker 管理任务在 Web 浏览器中变得更加容易和简单。今天,我遇到了另一个名为 **“Dockly”** 的 Docker 管理工具。
与上面的工具不同Dockly 是一个 TUI文本界面程序用于在类 Unix 系统中从终端管理 Docker 容器和服务。它是使用 **NodeJS** 编写的免费开源工具。在本简要指南中,我们将了解如何安装 Dockly 以及如何从命令行管理 Docker 容器。
### 安装 Dockly
确保已在 Linux 上安装了 NodeJS。如果尚未安装请参阅以下指南。
* [**如何在 Linux 上安装 NodeJS**][5]
安装 NodeJS 后,运行以下命令安装 Dockly
```
# npm install -g dockly
```
### 使用 Dockly 在终端管理 Docker 容器
使用 Dockly 管理 Docker 容器非常简单!你所要做的就是打开终端并运行以下命令:
```
# dockly
```
Dockly 将通过 unix 套接字自动连接到你的本机 docker 守护进程,并在终端中显示正在运行的容器列表,如下所示。
![][6]
使用 Dockly 管理 Docker 容器
正如你在上面的截图中看到的Dockly 在顶部显示了运行容器的以下信息:
* 容器 ID
  * 容器名称,
  * Docker 镜像,
  * 命令,
  * 运行中容器的状态,
  * 状态。
在右上角,你将看到容器的 CPU 和内存利用率。使用向上/向下箭头键在容器之间移动。
在底部,有少量的键盘快捷键来执行各种 Docker 管理任务。以下是目前可用的键盘快捷键列表:
* **=** - 刷新 Dockly 界面,
  * **/** - 搜索容器列表视图,
  * **i** - 显示有关当前所选容器或服务的信息,
  * **回车** - 显示当前容器或服务的日志,
  * **v** - 在容器和服务视图之间切换,
  * **l** - 在选定的容器上启动 /bin/bash 会话,
  * **r** - 重启选定的容器,
  * **s** - 停止选定的容器,
  * **h** - 显示帮助窗口,
  * **q** - 退出 Dockly。
##### **查看容器的信息**
使用向上/向下箭头选择一个容器,然后按 **“i”** 以显示所选容器的信息。
![][7]
查看容器的信息
##### 重启容器
如果你想随时重启容器,只需选择它并按 **“r”** 即可重新启动。
![][8]
重启 Docker 容器
##### 停止/删除容器和镜像
如果不再需要容器,我们可以立即停止和/或删除一个或所有容器。为此,请按 **“m”** 打开**菜单**。
![][9]
停止,删除 Docker 容器和镜像
在这里,你可以执行以下操作。
* 停止所有 Docker 容器,
  * 删除选定的容器,
  * 删除所有容器,
  * 删除所有 Docker 镜像等。
##### 显示 Dockly 帮助部分
如果你有任何疑问,只需按 **“h”** 即可打开帮助部分。
![][10]
Dockly 帮助
有关更多详细信息,请参考最后给出的官方 GitHub 页面。
就是这些了。希望这篇文章有用。如果你一直在使用 Docker 容器,请试试 Dockly看它是否有帮助。
* * *
**建议阅读:**
* **[如何自动更新正在运行的 Docker 容器][11]**
* **[ctop -一个 Linux 容器的命令行监控工具][12]**
* * *
**资源:**
* [**Dockly 的 GitHub 仓库**][13]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/dockly-manage-docker-containers-from-terminal/
作者:[sk][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2019/05/Dockly-720x340.png
[2]: https://www.ostechnix.com/getting-started-with-docker/
[3]: https://www.ostechnix.com/portainer-an-easiest-way-to-manage-docker/
[4]: https://www.ostechnix.com/picluster-simple-web-based-docker-management-application/
[5]: https://www.ostechnix.com/install-node-js-linux/
[6]: http://www.ostechnix.com/wp-content/uploads/2019/05/Manage-Docker-Containers-Using-Dockly.png
[7]: http://www.ostechnix.com/wp-content/uploads/2019/05/View-containers-information.png
[8]: http://www.ostechnix.com/wp-content/uploads/2019/05/Restart-containers.png
[9]: http://www.ostechnix.com/wp-content/uploads/2019/05/stop-remove-containers-and-images.png
[10]: http://www.ostechnix.com/wp-content/uploads/2019/05/Dockly-Help.png
[11]: https://www.ostechnix.com/automatically-update-running-docker-containers/
[12]: https://www.ostechnix.com/ctop-commandline-monitoring-tool-linux-containers/
[13]: https://github.com/lirantal/dockly