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.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 |