使用Docker Desktop管理容器
Once you start a Docker container, if you go and click the Docker icon in the toolbar and choose Dashboard, you will see it in Docker Desktop:
启动Docker容器后 ,如果单击工具栏中的Docker图标并选择Dashboard,则将在Docker Desktop中看到它:
Now if you hover the container with the mouse, you will see 5 buttons:
现在,如果用鼠标悬停容器,您将看到5个按钮:
They are:
他们是:
- Open in browser 在浏览器中打开
- CLI 命令行界面
- Stop 停止
- Restart 重新开始
- Delete 删除
You can manage your container lifecycle through them.
您可以通过它们管理容器的生命周期。
Clicking a container name in the list will reveal more data, including a Logs manager:
单击列表中的容器名称将显示更多数据,包括日志管理器:
An inspector that tells you useful information about the container:
一个检查器,告诉您有关容器的有用信息:
And stats about the container CPU, Memory, Network and Disk usage:
以及有关容器CPU,内存,网络和磁盘使用情况的统计信息:
Go back and click the Open in browser button and the http://localhost/tutorial
URL will open (http://localhost
redirects to http://localhost/tutorial
in this app):
返回并单击“在浏览器中打开”按钮,将打开http://localhost/tutorial
URL(此应用程序中http://localhost
重定向到http://localhost/tutorial
):
This is the content of a website that’s provided by our sample image. Now go back to Docker Desktop and press the Stop button
这是我们的示例图像提供的网站内容。 现在回到Docker Desktop并按下Stop按钮
and refresh the page, it does not work any more:
并刷新页面,它将不再起作用:
Go back to Docker Desktop and press the Start button, it will work again.
返回Docker Desktop并按“ 开始”按钮,它将再次运行。
Try pressing the CLI button. A new terminal window will open and you will automatically be connected to the Docker Container, as the root
user:
尝试按CLI按钮。 一个新的终端窗口将打开,您将以root
用户身份自动连接到Docker Container:
In the above picture the whoami
command returns the current user name.
在上图中, whoami
命令返回当前用户名。
Download my free books, and check out my premium React/Vue/Svelte/Node/Next.js courses!
翻译自: https://flaviocopes.com/docker-desktop-manage-container/