跳到主要内容

容器管理

本章管理配置注册的模型与基础设施容器,不是 Docker 任意操作 API。导航/建图优先使用前面专用接口。

14.1 容器目录与详情​

接口参数响应 data
GET /v1/api/runtime/containers/models无string[],所有已注册服务名,不限定只含 model
GET /v1/api/runtime/containersquery class 可选:model / infraContainerInfo[]
GET /v1/api/runtime/containers/{name}path name 为注册服务名ContainerInfo
{"name":"model-service","service_class":"model","role":"inference","container_name":"model-container","state":"HEALTHY","health":"no_probe","critical":false,"allow_manual_stop":true}
字段类型说明
name、service_class、role、container_namestring服务名、model/infra、角色、Docker 名称
statestringUNKNOWN / STOPPED / HEALTHY / DEGRADED;FAILED 是预留定义,不保证实际产生
healthstringok / fail / unknown / no_probe
critical、allow_manual_stopboolean关键性信息、允许手动停止
mutex_groupstring,可省略互斥组

无探针的容器可能为 HEALTHY/no_probe,这不是算法端到端健康证明。

14.2 异步启停​

接口请求成功响应
POST /v1/api/runtime/containers/{name}/actions/start无请求体data=null
POST /v1/api/runtime/containers/{name}/actions/stop可省略或 {"force":false}data=null

force 为 boolean,默认 false;具体策略由容器服务执行。启停 handler 在后台以最长 5 分钟上下文执行,HTTP 立即成功,甚至未知名称、互斥策略拒绝或 Docker 故障也可能发生在 HTTP 返回之后,仅写入日志。不要承诺这些后台错误一定在本次响应中返回 404/409/500。

客户端先查目录确认 name,发起操作后轮询详情:启动观察 HEALTHY,停止观察 STOPPED;超过应用时限仍未达到目标时展示失败并查看日志。查询类接口可返回 404/1002、500/4005 等。停止请求 JSON 非法为 400/1001。互斥与手动停机保护是运行时策略,不靠 force 绕过未知规则。