MCPcopy Index your code
hub / github.com/learnhouse/learnhouse / dockerStatsForContainers

Function dockerStatsForContainers

apps/cli/src/services/docker.ts:240–246  ·  view source on GitHub ↗
(containerNames: string[])

Source from the content-addressed store, hash-verified

238}
239
240export function dockerStatsForContainers(containerNames: string[]): string {
241 if (containerNames.length === 0) return ''
242 return execSync(
243 `docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}" ${containerNames.join(' ')}`,
244 { stdio: 'pipe' },
245 ).toString()
246}
247
248export function dockerExec(containerName: string, cmd: string): string {
249 return execSync(`docker exec ${containerName} ${cmd}`, {

Callers 4

healthCommandFunction · 0.85
scaleResourcesFunction · 0.85
scaleCommandFunction · 0.85
unit.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected