Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

fix(docker-widget): memory usage wrong (#4266)

Meier Lukascccec5e19538
diff --git a/packages/request-handler/src/docker.ts b/packages/request-handler/src/docker.ts
index 932d47e67..3e30aa1a6 100644
--- a/packages/request-handler/src/docker.ts
+++ b/packages/request-handler/src/docker.ts
@@ -47,7 +47,7 @@ async function getContainersWithStatsAsync() {
const instance = dockerInstances.find(({ host }) => host === container.instance)?.instance;
if (!instance) return null;
- const stats = await instance.getContainer(container.Id).stats({ stream: false });
+ const stats = await instance.getContainer(container.Id).stats({ stream: false, "one-shot": true });
return {
id: container.Id,
@@ -60,7 +60,8 @@ async function getContainersWithStatsAsync() {
return icon.name.toLowerCase().includes(extractedImage.toLowerCase());
})?.url ?? null,
cpuUsage: calculateCpuUsage(stats),
- memoryUsage: stats.memory_stats.usage,
+ // memory usage by default includes cache, which should not be shown as it is also not shown with docker stats command
+ memoryUsage: stats.memory_stats.usage - stats.memory_stats.stats.cache,
image: container.Image,
ports: container.Ports,
};