跳转到正文

Docker 验证证据 ​

NATS 已验证 · Verified 🕒 快照采集: 2026-08-23 15:19:49 UTC

官方镜像为 distroless,仅有 nats-server;nats CLI 独立发行,不伪装成镜像自带能力。

🐳 镜像:server:nats:2.11.5
🛠️ 关键工具:nats-server
🔨 构建/检查无镜像内建队列/主题 CLI
🚀 运行/交互8222 /healthz、/varz、/connz、/subsz
docker-session.out.txt
## status
[cli-tools] $ curl -fsS http://127.0.0.1:8222/healthz
{"status":"ok"}

## gap
# 缺口记录:nats 官方镜像不含 nats CLI(由 nats-io/natscli 独立发行),distroless 镜像连 shell 都没有,
# 纯镜像自带命令无法收发消息;收发需外部客户端(Java 实验见 demos/nats/core-pubsub)。
[cli-tools] $ compose exec nats nats --version   # 尝试在容器内寻找自带 CLI,预期失败
OCI runtime exec failed: exec failed: unable to start container process: exec: "nats": executable file not found in $PATH
exit=127(预期失败:镜像不含 nats 二进制)

## varz
[cli-tools] $ curl -fsS http://127.0.0.1:8222/varz
{
  "server_id": "NBWDRAPRGUPMWTMYXIZKNZRK26AKOZNPIHAIFUMH5ZSY5DN2ZOKGD45T",
  "server_name": "NBWDRAPRGUPMWTMYXIZKNZRK26AKOZNPIHAIFUMH5ZSY5DN2ZOKGD45T",
  "version": "2.11.5",
  "proto": 1,
  "git_commit": "94fb8b0",
  "go": "go1.24.4",
  "host": "0.0.0.0",
  "port": 4222,
  "max_connections": 65536,
  "ping_interval": 120000000000,
  "ping_max": 2,
  "http_host": "0.0.0.0",
  "http_port": 8222,
  "http_base_path": "",
  "https_port": 0,
  "auth_timeout": 2,
  "max_control_line": 4096,
  "max_payload": 1048576,
  "max_pending": 67108864,
  "cluster": {},
  "gateway": {},
  "leaf": {},
  "mqtt": {},
  "websocket": {},
  "jetstream": {
    "config": {
      "max_memory": 12574804992,
      "max_storage": 68064571392,
      "store_dir": "/tmp/nats/jetstream",
      "sync_interval": 120000000000
    },
    "stats": {
      "memory": 0,
      "storage": 0,
      "reserved_memory": 0,
      "reserved_storage": 0,
      "accounts": 1,
      "ha_assets": 0,
      "api": {
        "level": 1,
        "total": 0,
        "errors": 0
      }
    },
    "limits": {}
  },
  "tls_timeout": 2,
  "write_deadline": 10000000000,
  "start": "2026-08-23T15:17:21.243592603Z",
  "now": "2026-08-23T15:17:21.997112291Z",
  "uptime": "0s",
  "mem": 15831040,
  "cores": 4,
  "gomaxprocs": 4,
  "cpu": 3,
  "connections": 0,
  "total_connections": 0,
  "routes": 0,
  "remotes": 0,
  "leafnodes": 0,
  "in_msgs": 0,
  "out_msgs": 0,
  "in_bytes": 0,
  "out_bytes": 0,
  "slow_consumers": 0,
  "subscriptions": 63,
  "http_req_stats": {
    "/healthz": 2,
    "/varz": 1
  },
  "config_load_time": "2026-08-23T15:17:21.243592603Z",
  "config_digest": "",
  "system_account": "$SYS",
  "slow_consumer_stats": {
    "clients": 0,
    "routes": 0,
    "gateways": 0,
    "leafs": 0
  }
}

## connz
[cli-tools] $ curl -fsS http://127.0.0.1:8222/connz
{
  "server_id": "NBWDRAPRGUPMWTMYXIZKNZRK26AKOZNPIHAIFUMH5ZSY5DN2ZOKGD45T",
  "now": "2026-08-23T15:17:22.004747792Z",
  "num_connections": 0,
  "total": 0,
  "offset": 0,
  "limit": 1024,
  "connections": []
}

## subsz
[cli-tools] $ curl -fsS http://127.0.0.1:8222/subsz
{
  "num_subscriptions": 63,
  "num_cache": 5,
  "num_inserts": 63,
  "num_removes": 0,
  "num_matches": 6,
  "cache_hit_rate": 0.16666666666666666,
  "max_fanout": 1,
  "avg_fanout": 0.8
}

以统一实验验证消息系统语义边界