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

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

介绍

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

优点:

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

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

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

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

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

安装和更新

linux或macos下安装:

go 复制代码
brew install dtop

docker image 安装运行:

go 复制代码
docker run -v /var/run/docker.sock:/var/run/docker.sock -it ghcr.io/amir20/dtop

脚本安装:

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

rust管理器cargo方式安装:

go 复制代码
cargo install dtop

更新:

go 复制代码
dtop update

使用帮助

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

go 复制代码
> 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

配置文件:

go 复制代码
1 ./config.yaml 或 ./config.yml
2. ./.dtop.yaml 或 ./.dtop.yml
3. ~/.config/dtop/config.yaml 或 ~/.config/dtop/config.yml
4. ~/.dtop.yaml 或 ~/.dtop.yml

示例配置:

go 复制代码
# 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

或监控特定的应用:

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

本地连接:

go 复制代码
dtop --host local
# or simply
dtop

tcp方式远程连接docker:

go 复制代码
dtop --host tcp://host2:2375

ssh连接docker:

go 复制代码
dtop --host ssh://user@host
# With custom port
dtop --host ssh://user@host:2222

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

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

同时连接多个主机:

go 复制代码
dtop --host local --host tcp://host2:2375 --host ssh://user@host

演示视频:

相关推荐
WangMingHua1112 小时前
LM Studio Docker 部署——本地大模型一键启动
docker
SelectDB21 小时前
Litefuse 开源并推出单进程轻量模式,25 秒就能跑起来的 Agent 可观测与评估平台
运维·后端·自动化运维
曲幽1 天前
别再用网页翻译看源码了!你的私人翻译神器LibreTranslate,部署避坑指南来了
python·docker·web·pot·translate·libretranslate·arogstranslate
XIAOHEZIcode2 天前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
用户0328472220703 天前
如何搭建本地yum源(上)
运维
武子康3 天前
调查研究-183 Apple container:Mac 上用轻量 VM 跑 Linux 容器,Swift 会改写本地容器体验吗?
docker·容器·apple
大树886 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
摇滚侠6 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
霸道流氓气质6 天前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务
Inhand陈工6 天前
基于台达PLC与映翰通IG502的智慧水产养殖精准投喂与远程运维解决方案
运维·人工智能·物联网·阿里云·信息与通信