我正在尝试使用cpu_usage
API测量docker容器的总数GET /containers/$CONTAINER_ID/stats
,并且在容器运行时,端点返回有意义的数据:
{"cpu_usage":{"total_usage":213788430,"percpu_usage":[1917539,288587,145139232,1911156,5966276,4931989,11474144,1252778,593573,847283,39465873,0],"usage_in_kernelmode":20000000,"usage_in_usermode":160000000}
但是一旦退出,一切都会归零:
{"cpu_usage":{"total_usage":0,"usage_in_kernelmode":0,"usage_in_usermode":0}
如何获得完成工作的Docker容器的总CPU使用率?