Docker

In this section you will learn how to get information about docker containers, stats and processes inside a docker container:

For function reference and examples we assume, that we imported systeminformation as follows:

const si = require('systeminformation');

Container, Stats, Processes

All functions in this section return a promise or can be called with a callback function (parameter cb in the function reference)

Function Result object Linux BSD Mac Win Sun Comments
si.dockerInfo(cb) {...} X X X X X returns general docker info
ID X X X X X Docker ID
Containers X X X X X number of containers
ContainersRunning X X X X X number of running containers
ContainersPaused X X X X X number of paused containers
ContainersStopped X X X X X number of stopped containers
Images X X X X X number of images
Driver X X X X X driver (e.g. 'devicemapper', 'overlay2')
MemoryLimit X X X X X has memory limit
SwapLimit X X X X X has swap limit
KernelMemory X X X X X has kernal memory
CpuCfsPeriod X X X X X has CpuCfsPeriod
CpuCfsQuota X X X X X has CpuCfsQuota
CPUShares X X X X X has CPUShares
CPUSet X X X X X has CPUShares
IPv4Forwarding X X X X X has IPv4Forwarding
BridgeNfIptables X X X X X has BridgeNfIptables
BridgeNfIp6tables X X X X X has BridgeNfIp6tables
Debug X X X X X Debug on
NFd X X X X X named data networking forwarding daemon
OomKillDisable X X X X X out-of-memory kill disabled
NGoroutines X X X X X number NGoroutines
SystemTime X X X X X docker SystemTime
LoggingDriver X X X X X logging driver e.g. 'json-file'
CgroupDriver X X X X X cgroup driver e.g. 'cgroupfs'
NEventsListener X X X X X number NEventsListeners
KernelVersion X X X X X docker kernel version
OperatingSystem X X X X X docker OS e.g. 'Docker for Mac'
OSType X X X X X OSType e.g. 'linux'
Architecture X X X X X architecture e.g. x86_64
NCPU X X X X X number of CPUs
MemTotal X X X X X memory total
DockerRootDir X X X X X docker root directory
HttpProxy X X X X X http proxy
HttpsProxy X X X X X https proxy
NoProxy X X X X X NoProxy
Name X X X X X Name
Labels X X X X X array of labels
ExperimentalBuild X X X X X is experimental build
ServerVersion X X X X X server version
ClusterStore X X X X X cluster store
ClusterAdvertise X X X X X cluster advertise
DefaultRuntime X X X X X default runtime e.g. 'runc'
LiveRestoreEnabled X X X X X live store enabled
Isolation X X X X X isolation
InitBinary X X X X X init binary
ProductLicense X X X X X product license
si.dockerContainers(all, cb) [{...}] X X X X X returns array of active/all docker containers
[0].id X X X X X ID of container
[0].name X X X X X name of container
[0].image X X X X X name of image
[0].imageID X X X X X ID of image
[0].command X X X X X command
[0].created X X X X X creation time (unix time)
[0].started X X X X X started time (unix time)
[0].finished X X X X X finished time (unix time)
[0].createdAt X X X X X creation date time string
[0].startedAt X X X X X creation date time string
[0].finishedAt X X X X X creation date time string
[0].state X X X X X created, running, exited
[0].restartCount X X X X X restart count
[0].platform X X X X X e.g. linux
[0].driver X X X X X e.g. overlay2 or devicemapper
[0].ports X X X X X array of ports
[0].mounts X X X X X array of mounts
si.dockerContainerStats(ids, cb) [{...}] X X X X X statistics for specific containers
container IDs: space or comma separated,
pass '*' for all containers
id X X X X X Container ID
mem_usage X X X X X memory usage in bytes
mem_limit X X X X X memory limit (max mem) in bytes
mem_percent X X X X X memory usage in percent
cpu_percent X X X X X cpu usage in percent
pids X X X X X number of processes
netIO.rx X X X X X received bytes via network
netIO.wx X X X X X sent bytes via network
blockIO.r X X X X X bytes read from BlockIO
blockIO.w X X X X X bytes written to BlockIO
restartCount X X X X X restart count
cpu_stats X X X X X detailed cpu stats
percpu_stats X X X X X detailed per cpu stats
memory_stats X X X X X detailed memory stats
networks X X X X X detailed network stats per interface
si.dockerContainerProcesses(id, cb) [{...}] X X X X X array of processes inside a container
[0].pid_host X X X X X process ID (host)
[0].ppid X X X X X parent process ID
[0].pgid X X X X X process group ID
[0].user X X X X X effective user name
[0].ruser X X X X X real user name
[0].group X X X X X effective group name
[0].rgroup X X X X X real group name
[0].stat X X X X X process state
[0].time X X X X X accumulated CPU time
[0].elapsed X X X X X elapsed running time
[0].nice X X X X X nice value
[0].rss X X X X X resident set size
[0].vsz X X X X X virtual size in Kbytes
[0].command X X X X X command and arguments
si.dockerAll(cb) {...} X X X X X list of all containers including their stats
and processes in one single array