news 2026/4/21 7:08:15

一款用于监控跨多台主机 Docker 容器的实时终端

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
一款用于监控跨多台主机 Docker 容器的实时终端

一款用于监控跨多台主机 Docker 容器的实时终端用户界面。可直接在终端跟踪 CPU、内存和网络指标。 速度极快,资源占用极低。

介绍

它支持 ssh、tcp 和本地连接,并与 Dozzle 集成用于容器日志。

优点:

  • 💻 实时监控 ——容器状态和指标的实时更新;

  • ⚡ 轻量化——用 Rust 极其快速且轻便;

  • 🌍 多主机支持 - 监控跨多主机的容器;

  • 🔍 Dozzle - 支持通过键盘快捷键打开 Dozzle 链接;

  • 📝 日志流—— 实时查看容器日志;

安装和更新

linux或macos下安装:

brew install dtop

docker image 安装运行:

docker run -v /var/run/docker.sock:/var/run/docker.sock -it ghcr.io/amir20/dtop

脚本安装:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/amir20/dtop/releases/latest/download/dtop-installer.sh | sh

rust管理器cargo方式安装:

cargo install dtop

更新:

dtop update

使用帮助

默认情况下,dtop 会通过/var/run/docker.sock连接到本地的 Docker 守护进程。DOCKER_HOST 也支持连接其他主机。

> dtop --help A terminal-based Docker container monitoring tool with real-time CPU and memory metrics Usage: dtop [OPTIONS] [COMMAND] Commands: update Update dtop to the latest version help Print this message or the help of the given subcommand(s) Options: -H, --host <HOST> Docker host(s) to connect to. Can be specified multiple times. Examples: --host local (Connect to local Docker daemon) --host ssh://user@host (Connect via SSH) --host ssh://user@host:2222 (Connect via SSH with custom port) --host tcp://host:2375 (Connect via TCP to remote Docker daemon) --host tls://host:2376 (Connect via TLS) --host local --host ssh://user@server1 --host tls://server2:2376 (Multiple hosts) For TLS connections, set DOCKER_CERT_PATH to a directory containing: key.pem, cert.pem, and ca.pem If not specified, will use config file or default to "local" -i, --icons <ICONS> Icon style to use for the UI Options: unicode - Standard Unicode icons (default, works everywhere) nerd - Nerd Font icons (requires Nerd Font installed) -f, --filter <FILTER> Filter containers (can be specified multiple times) Examples: --filter status=running --filter name=nginx --filter label=com.example.version=1.0 --filter ancestor=ubuntu:24.04 Multiple filters of the same type use OR logic: --filter status=running --filter status=paused Different filter types use AND logic: --filter status=running --filter name=nginx Available filters: id, name, label, status, ancestor, before, since, volume, network, publish, expose, health, exited Note: Some filters only work with container listing, not events. Warnings will be shown if a filter is incompatible with events. -a, --all Show all containers (default shows only running containers) By default, dtop only shows running containers. Use this flag to show all containers including stopped, exited, and paused containers. Note: This flag can only enable showing all containers, not disable it. If your config file has 'all: true', you'll need to edit the config file or press 'a' in the UI to toggle back to showing only running containers. This is equivalent to pressing 'a' in the UI to toggle show all. -s, --sort <SORT> Default sort field for container list Options: uptime - Sort by container uptime/creation time (default, newest first) name - Sort by container name (alphabetically) cpu - Sort by CPU usage (highest first) memory - Sort by memory usage (highest first) You can also use short forms: u, n, c, m The sort direction can be toggled in the UI by pressing the same key again. -h, --help Print help (see a summary with '-h') -V, --version Print version

配置文件:

1 ./config.yaml 或 ./config.yml 2. ./.dtop.yaml 或 ./.dtop.yml 3. ~/.config/dtop/config.yaml 或 ~/.config/dtop/config.yml 4. ~/.dtop.yaml 或 ~/.dtop.yml

示例配置:

# Monitor production servers with filters and Dozzle integration hosts: - host: ssh://user@prod-server1 dozzle: https://dozzle.prod-server1.com/ filter: - status=running - label=environment=production - host: ssh://user@prod-server2 dozzle: https://dozzle.prod-server2.com/ filter: - status=running - label=environment=production # Use Nerd Font icons for better visuals icons: nerd

或监控特定的应用:

# Development environment - only show healthy web services hosts: - host: local filter: - label=app=web - status=running - health=healthy

本地连接:

dtop --host local # or simply dtop

tcp方式远程连接docker:

dtop --host tcp://host2:2375

ssh连接docker:

dtop --host ssh://user@host # With custom port dtop --host ssh://user@host:2222

tls加密方式连接远程docker(需要通过 DOCKER_CERT_PATH 环境变量配置证书。)

export DOCKER_CERT_PATH=/path/to/certs # Directory containing key.pem, cert.pem, and ca.pem dtop --host tls://host2:2376

同时连接多个主机:

dtop --host local --host tcp://host2:2375 --host ssh://user@host

演示视频:

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/21 6:51:15

用Python和NumPy手把手实现一个卡尔曼滤波器(附完整代码与可视化)

用Python和NumPy手把手实现一个卡尔曼滤波器&#xff08;附完整代码与可视化&#xff09; 卡尔曼滤波器在机器人导航、自动驾驶和金融预测等领域有着广泛应用。但对于初学者来说&#xff0c;那些复杂的矩阵运算和概率公式常常让人望而却步。今天我们就用Python和NumPy&#xff…

作者头像 李华
网站建设 2026/4/21 6:45:23

代购系统物流轨迹聚合:多承运商统一查询接口设计

在代购与跨境电商业务中&#xff0c;物流轨迹查询是用户体验与订单履约的核心环节。面对顺丰、中通、DHL、FedEx、云途、燕文等数十家国内外承运商接口异构、数据格式混乱、维护成本高企的痛点&#xff0c;设计一套多承运商统一查询接口&#xff0c;实现一次对接、全域查询、数…

作者头像 李华
网站建设 2026/4/21 6:41:06

3个关键问题:为什么你的Windows播放器需要LAV Filters解码器?

3个关键问题&#xff1a;为什么你的Windows播放器需要LAV Filters解码器&#xff1f; 【免费下载链接】LAVFilters LAV Filters - Open-Source DirectShow Media Splitter and Decoders 项目地址: https://gitcode.com/gh_mirrors/la/LAVFilters 你是否曾经遇到过这样的…

作者头像 李华