dockerImages() added

This commit is contained in:
Sebastian Hildebrandt 2021-02-24 13:25:48 +01:00
parent 0df76f0bcf
commit ac7f840656
11 changed files with 578 additions and 101 deletions

View File

@ -72,47 +72,48 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.3.5 | 2020-02-23 | `dockerContainerStats()` fixed parameter * |
| 5.3.4 | 2020-02-20 | `sanitizeShellString()` optimized strict sanitation |
| 5.3.3 | 2020-02-15 | `dockerContainerStats()` fixed ID splitting |
| 5.3.2 | 2020-02-15 | `inetLatency()` `ineChecksite()` fixed possible security issue (file://) |
| 5.3.1 | 2020-02-14 | `inetLatency()` `ineChecksite()` `servcices()` `processes()` fixed possible security issue (arrays) |
| 5.3.0 | 2020-02-12 | `osInfo()` added remoteSession (windows) |
| 5.2.7 | 2020-02-12 | `fsStats()`, `blockDevices()` improved linux |
| 5.2.6 | 2020-02-12 | `inetLatency()` fixed possible DOS intrusion |
| 5.2.5 | 2020-02-11 | `processes()` fixed truncated params (linux) |
| 5.2.4 | 2020-02-11 | `currentLoad()` fixed issue |
| 5.2.3 | 2020-02-11 | `diskLayout()` added USB drives (mac OS) |
| 5.2.2 | 2020-02-11 | code cleanup, updated docs |
| 5.2.1 | 2020-02-10 | `system()` fixed issue virtual detect (linux) |
| 5.2.0 | 2020-02-10 | `wifiInterfces()` and `wifiConnections()` added |
| 5.1.2 | 2020-02-08 | fixed node 4 compatibility issue |
| 5.1.1 | 2020-02-08 | `baseboard()` added memMax, memSlots, smaller improvements Raspberry |
| 5.1.0 | 2020-02-08 | `memLayout()` added ECC flag, `bios()` added language, features (linux) |
| 5.0.11 | 2020-02-07 | `fsSize()` fixed windows WSL issue |
| 5.0.10 | 2020-02-06 | `getDynamicData()` fixed windows WSL issue |
| 5.0.9 | 2020-02-02 | `fsSize()` fixed parsing edge case issue mac OS |
| 5.0.8 | 2020-01-30 | typescript typings fix cpuCurrentSpeed |
| 5.0.7 | 2020-01-29 | `fsSize()` available fixed windows and typescript typings |
| 5.0.6 | 2020-01-28 | `osinfo()` added hypervisor (win only) |
| 5.0.5 | 2020-01-27 | `networkInterfaces()` type detection improved (win) |
| 5.0.4 | 2020-01-27 | `cpu()` improved manufacturer decoding (linux) |
| 5.0.3 | 2020-01-27 | `cpu()` fix virtualization, `wifi()` fix raspberry |
| 5.0.2 | 2020-01-26 | updated typescript typings |
| 5.0.1 | 2020-01-26 | code cleanup |
| 5.0.0 | 2020-01-26 | new major version 5 release |
| 4.34.9 | 2020-01-25 | `graphics()` virtual controller vram value fix (win) |
| 4.34.8 | 2020-01-25 | `graphics()` controller subDeviceId fix (win) |
| 4.34.7 | 2020-01-13 | `services()` improved service discovery (linux) |
| 4.34.6 | 2020-01-12 | `networkInterfaces()` catch errors |
| 4.34.5 | 2020-01-07 | `networkInterfaceDefault()` fixed CMD popup (windows) |
| 4.34.4 | 2020-01-06 | `system()` fixed vitrual catch error |
| 4.34.3 | 2020-01-06 | `graphics()` fixed non nvidia-smi controllers (win) |
| 4.34.2 | 2020-01-05 | `system()` uuid lowercase as in uuid() |
| 4.34.1 | 2020-01-05 | `graphics()` nvidia-smi detection improved |
| 4.34.0 | 2020-01-05 | `system()` added flag virtual |
| 4.33.8 | 2020-01-04 | `virtualBox()` fix issue windows host |
| 4.33.7 | 2020-01-04 | `graphics()` nvidia-smi detection improved |
| 5.4.0 | 2021-02-24 | `dockerImages()` added |
| 5.3.5 | 2021-02-23 | `dockerContainerStats()` fixed parameter * |
| 5.3.4 | 2021-02-20 | `sanitizeShellString()` optimized strict sanitation |
| 5.3.3 | 2021-02-15 | `dockerContainerStats()` fixed ID splitting |
| 5.3.2 | 2021-02-15 | `inetLatency()` `ineChecksite()` fixed possible security issue (file://) |
| 5.3.1 | 2021-02-14 | `inetLatency()` `ineChecksite()` `servcices()` `processes()` fixed possible security issue (arrays) |
| 5.3.0 | 2021-02-12 | `osInfo()` added remoteSession (windows) |
| 5.2.7 | 2021-02-12 | `fsStats()`, `blockDevices()` improved linux |
| 5.2.6 | 2021-02-12 | `inetLatency()` fixed possible DOS intrusion |
| 5.2.5 | 2021-02-11 | `processes()` fixed truncated params (linux) |
| 5.2.4 | 2021-02-11 | `currentLoad()` fixed issue |
| 5.2.3 | 2021-02-11 | `diskLayout()` added USB drives (mac OS) |
| 5.2.2 | 2021-02-11 | code cleanup, updated docs |
| 5.2.1 | 2021-02-10 | `system()` fixed issue virtual detect (linux) |
| 5.2.0 | 2021-02-10 | `wifiInterfces()` and `wifiConnections()` added |
| 5.1.2 | 2021-02-08 | fixed node 4 compatibility issue |
| 5.1.1 | 2021-02-08 | `baseboard()` added memMax, memSlots, smaller improvements Raspberry |
| 5.1.0 | 2021-02-08 | `memLayout()` added ECC flag, `bios()` added language, features (linux) |
| 5.0.11 | 2021-02-07 | `fsSize()` fixed windows WSL issue |
| 5.0.10 | 2021-02-06 | `getDynamicData()` fixed windows WSL issue |
| 5.0.9 | 2021-02-02 | `fsSize()` fixed parsing edge case issue mac OS |
| 5.0.8 | 2021-01-30 | typescript typings fix cpuCurrentSpeed |
| 5.0.7 | 2021-01-29 | `fsSize()` available fixed windows and typescript typings |
| 5.0.6 | 2021-01-28 | `osinfo()` added hypervisor (win only) |
| 5.0.5 | 2021-01-27 | `networkInterfaces()` type detection improved (win) |
| 5.0.4 | 2021-01-27 | `cpu()` improved manufacturer decoding (linux) |
| 5.0.3 | 2021-01-27 | `cpu()` fix virtualization, `wifi()` fix raspberry |
| 5.0.2 | 2021-01-26 | updated typescript typings |
| 5.0.1 | 2021-01-26 | code cleanup |
| 5.0.0 | 2021-01-26 | new major version 5 release |
| 4.34.9 | 2021-01-25 | `graphics()` virtual controller vram value fix (win) |
| 4.34.8 | 2021-01-25 | `graphics()` controller subDeviceId fix (win) |
| 4.34.7 | 2021-01-13 | `services()` improved service discovery (linux) |
| 4.34.6 | 2021-01-12 | `networkInterfaces()` catch errors |
| 4.34.5 | 2021-01-07 | `networkInterfaceDefault()` fixed CMD popup (windows) |
| 4.34.4 | 2021-01-06 | `system()` fixed vitrual catch error |
| 4.34.3 | 2021-01-06 | `graphics()` fixed non nvidia-smi controllers (win) |
| 4.34.2 | 2021-01-05 | `system()` uuid lowercase as in uuid() |
| 4.34.1 | 2021-01-05 | `graphics()` nvidia-smi detection improved |
| 4.34.0 | 2021-01-05 | `system()` added flag virtual |
| 4.33.8 | 2021-01-04 | `virtualBox()` fix issue windows host |
| 4.33.7 | 2021-01-04 | `graphics()` nvidia-smi detection improved |
| 4.33.6 | 2021-01-02 | `dockerContainerStats()` fix `tx` changed to `wx` as documented |
| 4.33.5 | 2020-12-30 | `graphics()` vram (nvidia-smi) |
| 4.33.4 | 2020-12-28 | `typescript` typings fix |

View File

@ -40,6 +40,7 @@ This next major version release 5.0 comes with new functionality and several imp
- added audio: get detailed audio device information
- added bluetooth: get detailed bluetooth device information
- added dockerImages: get detailed information about docker images
- added printer: get information from detected printers
- added usb: get detailed usb controller and device information
- added wifi interfaces ans connections: extended wifi information
@ -102,6 +103,7 @@ si.cpu()
(last 7 major and minor version releases)
- Version 5.4.0: `dockerImages()` added
- Version 5.3.0: `osInfo()` added remoteSession (win only)
- Version 5.2.0: `wifiInterfaces()` and `wifiConnections()` added
- Version 5.1.0: `memLayout()` added ECC flag, `bios()` added language, features (linux)
@ -668,6 +670,25 @@ Full function reference with examples can be found at [https://systeminformation
| | isolation | X | X | X | X | X | isolation |
| | initBinary | X | X | X | X | X | init binary |
| | productLicense | X | X | X | X | X | product license |
| si.dockerImages(all, cb) | [{...}] | X | X | X | X | X | returns array of top level/all docker images |
| | [0].id | X | X | X | X | X | image ID |
| | [0].container | X | X | X | X | X | container ID |
| | [0].comment | X | X | X | X | X | comment |
| | [0].os | X | X | X | X | X | OS |
| | [0].architecture | X | X | X | X | X | architecture |
| | [0].parent | X | X | X | X | X | parent ID |
| | [0].dockerVersion | X | X | X | X | X | docker version |
| | [0].size | X | X | X | X | X | image size |
| | [0].sharedSize | X | X | X | X | X | shared size |
| | [0].virtualSize | X | X | X | X | X | virtual size |
| | [0].author | X | X | X | X | X | author |
| | [0].created | X | X | X | X | X | created date / time |
| | [0].containerConfig | X | X | X | X | X | container config object |
| | [0].graphDriver | X | X | X | X | X | graph driver object |
| | [0].repoDigests | X | X | X | X | X | repo digests array |
| | [0].repoTags | X | X | X | X | X | repo tags array |
| | [0].config | X | X | X | X | X | config object |
| | [0].rootFS | X | X | X | X | X | root fs object |
| 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 |

View File

@ -47,7 +47,7 @@
<div class="col-12 sectionheader">
<div class="title">Docker</div>
<div class="text">
<p>In this section you will learn how to get information about docker containers, stats and processes inside a docker container:</p>
<p>In this section you will learn how to get information about docker, images, containers, container stats and processes inside a docker container:</p>
<p>For function reference and examples we assume, that we imported <span class="code">systeminformation</span> as follows:</p>
<pre><code class="js">const si = require('systeminformation');</code></pre>
<h2>Container, Stats, Processes</h2>
@ -536,6 +536,196 @@
<td>X</td>
<td>product license</td>
</tr>
<tr>
<td>si.dockerImages(all, cb)</td>
<td>[{...}]</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>returns array of top level/all docker images</td>
</tr>
<tr>
<td></td>
<td>[0].id</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>image ID</td>
</tr>
<tr>
<td></td>
<td>[0].container</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>container ID</td>
</tr>
<tr>
<td></td>
<td>[0].comment</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>comment</td>
</tr>
<tr>
<td></td>
<td>[0].os</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>OS</td>
</tr>
<tr>
<td></td>
<td>[0].architecture</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>architecture</td>
</tr>
<tr>
<td></td>
<td>[0].parent</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>parent ID</td>
</tr>
<tr>
<td></td>
<td>[0].dockerVersion</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>docker version</td>
</tr>
<tr>
<td></td>
<td>[0].size</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>image size</td>
</tr>
<tr>
<td></td>
<td>[0].sharedSize</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>shared size</td>
</tr>
<tr>
<td></td>
<td>[0].virtualSize</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>virtual size</td>
</tr>
<tr>
<td></td>
<td>[0].author</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>author</td>
</tr>
<tr>
<td></td>
<td>[0].created</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>created date / time</td>
</tr>
<tr>
<td></td>
<td>[0].containerConfig</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>container config object</td>
</tr>
<tr>
<td></td>
<td>[0].graphDriver</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>graph driver object</td>
</tr>
<tr>
<td></td>
<td>[0].repoDigests</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>repo digests array</td>
</tr>
<tr>
<td></td>
<td>[0].repoTags</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>repo tags array</td>
</tr>
<tr>
<td></td>
<td>[0].config</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>config object</td>
</tr>
<tr>
<td></td>
<td>[0].rootFS</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>root fs object</td>
</tr>
<tr>
<td>si.dockerContainers(all, cb)</td>
<td>[{...}]</td>

View File

@ -56,209 +56,214 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.4.0</th>
<td>2021-02-24</td>
<td><span class="code">dockerImages()</span> added</td>
</tr>
<tr>
<th scope="row">5.3.5</th>
<td>2020-02-23</td>
<td>2021-02-23</td>
<td><span class="code">dockerContainerStats()</span> fixed issue parameter *</td>
</tr>
<tr>
<th scope="row">5.3.4</th>
<td>2020-02-20</td>
<td>2021-02-20</td>
<td><span class="code">sanitizeShellString()</span> optimized strict sanitation</td>
</tr>
<tr>
<th scope="row">5.3.3</th>
<td>2020-02-15</td>
<td>2021-02-15</td>
<td><span class="code">dockerContainerStats()</span> fix correct ID splitting</td>
</tr>
<tr>
<th scope="row">5.3.2</th>
<td>2020-02-15</td>
<td>2021-02-15</td>
<td><span class="code">inetLatency()</span> <span class="code">inetChecksite()</span> fix possible security issue (file://)</td>
</tr>
<tr>
<th scope="row">5.3.1</th>
<td>2020-02-14</td>
<td>2021-02-14</td>
<td><span class="code">inetLatency()</span> <span class="code">inetChecksite()</span> <span class="code">services()</span> <span class="code">processLoad()</span> fix possible security issue</td>
</tr>
<tr>
<th scope="row">5.3.0</th>
<td>2020-02-12</td>
<td>2021-02-12</td>
<td><span class="code">osInfo()</span> added remoteSession (windows)</td>
</tr>
<tr>
<th scope="row">5.2.7</th>
<td>2020-02-12</td>
<td>2021-02-12</td>
<td><span class="code">fsStats()</span> and <span class="code">blockdevices()</span> improvements (linux)</td>
</tr>
<tr>
<th scope="row">5.2.6</th>
<td>2020-02-12</td>
<td>2021-02-12</td>
<td><span class="code">inetLatency()</span> fix DOS vulnerability</td>
</tr>
<tr>
<th scope="row">5.2.5</th>
<td>2020-02-11</td>
<td>2021-02-11</td>
<td><span class="code">processes()</span> fix truncated params (linux)</td>
</tr>
<tr>
<th scope="row">5.2.4</th>
<td>2020-02-11</td>
<td>2021-02-11</td>
<td><span class="code">currentLoad()</span> fix issue</td>
</tr>
<tr>
<th scope="row">5.2.3</th>
<td>2020-02-11</td>
<td>2021-02-11</td>
<td><span class="code">diskLayout()</span> added USB drives (mac OS)</td>
</tr>
<tr>
<th scope="row">5.2.2</th>
<td>2020-02-11</td>
<td>2021-02-11</td>
<td>code cleanup, updated docs</td>
</tr>
<tr>
<th scope="row">5.2.1</th>
<td>2020-02-10</td>
<td>2021-02-10</td>
<td><span class="code">system()</span> fixed issue virtual detect (linux)</td>
</tr>
<tr>
<th scope="row">5.2.0</th>
<td>2020-02-10</td>
<td>2021-02-10</td>
<td><span class="code">wifiInterfces()</span> and <span class="code">wifiConnections()</span> added</td>
</tr>
<tr>
<th scope="row">5.1.2</th>
<td>2020-02-08</td>
<td>2021-02-08</td>
<td>fixed node 4 compatibility issue</td>
</tr>
<tr>
<th scope="row">5.1.1</th>
<td>2020-02-08</td>
<td>2021-02-08</td>
<td><span class="code">baseboard()</span> added memMax, memSlots</td>
</tr>
<tr>
<th scope="row">5.1.0</th>
<td>2020-02-08</td>
<td>2021-02-08</td>
<td><span class="code">memLayout()</span> added ECC flag, <span class="code">bios()</span> added language, features (linux)</td>
</tr>
<tr>
<th scope="row">5.0.11</th>
<td>2020-02-07</td>
<td>2021-02-07</td>
<td><span class="code">fsSize()</span> windows WSL fix</td>
</tr>
<tr>
<th scope="row">5.0.10</th>
<td>2020-02-06</td>
<td>2021-02-06</td>
<td><span class="code">getDynamicData()</span> windows WSL fix</td>
</tr>
<tr>
<th scope="row">5.0.9</th>
<td>2020-02-02</td>
<td>2021-02-02</td>
<td><span class="code">fsSize()</span> fixed parsing edge case issue mac OS</td>
</tr>
<tr>
<th scope="row">5.0.8</th>
<td>2020-01-30</td>
<td>2021-01-30</td>
<td>typescript typings fix cpuCurrentSpeed</td>
</tr>
<tr>
<th scope="row">5.0.7</th>
<td>2020-01-29</td>
<td>2021-01-29</td>
<td><span class="code">fsSize()</span> available fixed windows and typescript typings</td>
</tr>
<tr>
<th scope="row">5.0.6</th>
<td>2020-01-28</td>
<td>2021-01-28</td>
<td><span class="code">osInfo()</span> added hypervisor (win only)</td>
</tr>
<tr>
<th scope="row">5.0.5</th>
<td>2020-01-27</td>
<td>2021-01-27</td>
<td><span class="code">networkInterfaces()</span> type detection improved (win)</td>
</tr>
<tr>
<th scope="row">5.0.4</th>
<td>2020-01-27</td>
<td>2021-01-27</td>
<td><span class="code">memoryLayout()</span> improved manufacturer decoding (linux)</td>
</tr>
<tr>
<th scope="row">5.0.3</th>
<td>2020-01-27</td>
<td>2021-01-27</td>
<td><span class="code">cpu()</span> fix virtualization, <span class="code">wifi()</span> fix raspberry</td>
</tr>
<tr>
<th scope="row">5.0.2</th>
<td>2020-01-26</td>
<td>2021-01-26</td>
<td>updated typescript typings</td>
</tr>
<tr>
<th scope="row">5.0.1</th>
<td>2020-01-26</td>
<td>2021-01-26</td>
<td>code cleanup</td>
</tr>
<tr>
<th scope="row">5.0.0</th>
<td>2020-01-26</td>
<td>2021-01-26</td>
<td>new major version 5 release</td>
</tr>
<tr>
<th scope="row">4.34.9</th>
<td>2020-01-25</td>
<td>2021-01-25</td>
<td><span class="code">graphics()</span> virtual controller vram value fix (win)</td>
</tr>
<tr>
<th scope="row">4.34.8</th>
<td>2020-01-25</td>
<td>2021-01-25</td>
<td><span class="code">graphics()</span> controller subDeviceId fix (win)</td>
</tr>
<tr>
<th scope="row">4.34.7</th>
<td>2020-01-13</td>
<td>2021-01-13</td>
<td><span class="code">services()</span> improved service discovery linux</td>
</tr>
<tr>
<th scope="row">4.34.6</th>
<td>2020-01-12</td>
<td>2021-01-12</td>
<td><span class="code">networkInterfaces()</span> catch errors</td>
</tr>
<tr>
<th scope="row">4.34.5</th>
<td>2020-01-07</td>
<td>2021-01-07</td>
<td><span class="code">networkInterfaceDefault()</span> fixed CMD popup (windows)</td>
</tr>
<tr>
<th scope="row">4.34.4</th>
<td>2020-01-06</td>
<td>2021-01-06</td>
<td><span class="code">system()</span> fixed vitrual catch error</td>
</tr>
<tr>
<th scope="row">4.34.3</th>
<td>2020-01-06</td>
<td>2021-01-06</td>
<td><span class="code">graphics()</span> issue non nvidia-smi controllers fixed (win)</td>
</tr>
<tr>
<th scope="row">4.34.2</th>
<td>2020-01-05</td>
<td>2021-01-05</td>
<td><span class="code">system()</span> uuid now lowercase - as in uuid()</td>
</tr>
<tr>
<th scope="row">4.34.1</th>
<td>2020-01-05</td>
<td>2021-01-05</td>
<td><span class="code">graphics()</span> nvidia-smi detection improved</td>
</tr>
<tr>
<th scope="row">4.34.0</th>
<td>2020-01-05</td>
<td>2021-01-05</td>
<td><span class="code">system()</span> added flag virtual</td>
</tr>
<tr>
<th scope="row">4.33.8</th>
<td>2020-01-04</td>
<td>2021-01-04</td>
<td><span class="code">virtualBox()</span> fix issue windows host</td>
</tr>
<tr>
<th scope="row">4.33.7</th>
<td>2020-01-04</td>
<td>2021-01-04</td>
<td><span class="code">graphics()</span> nvidia-smi detection improved</td>
</tr>
<tr>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.3.5</span></div>
<div class="version">New Version: <span id="version">5.4.0</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
@ -201,7 +201,7 @@
</div>
<div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">13,833</div>
<div class="numbers">14,053</div>
<div class="title">Lines of code</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">

View File

@ -91,6 +91,115 @@ function dockerInfo(callback) {
exports.dockerInfo = dockerInfo;
function dockerImages(all, callback) {
// fallback - if only callback is given
if (util.isFunction(all) && !callback) {
callback = all;
all = false;
}
if (typeof all !== 'boolean' && all !== undefined) {
all = false;
}
all = all || false;
let result = [];
return new Promise((resolve) => {
process.nextTick(() => {
if (!_docker_socket) {
_docker_socket = new DockerSocket();
}
const workload = [];
_docker_socket.listImages(all, data => {
let dockerImages = {};
try {
dockerImages = data;
if (dockerImages && Object.prototype.toString.call(dockerImages) === '[object Array]' && dockerImages.length > 0) {
dockerImages.forEach(function (element) {
if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
element.Name = element.Names[0].replace(/^\/|\/$/g, '');
}
workload.push(dockerImagesInspect(element.Id.trim(), element));
});
if (workload.length) {
Promise.all(
workload
).then(data => {
if (callback) { callback(data); }
resolve(data);
});
} else {
if (callback) { callback(result); }
resolve(result);
}
} else {
if (callback) { callback(result); }
resolve(result);
}
} catch (err) {
if (callback) { callback(result); }
resolve(result);
}
});
});
});
}
// --------------------------
// container inspect (for one container)
function dockerImagesInspect(imageID, payload) {
return new Promise((resolve) => {
process.nextTick(() => {
imageID = imageID || '';
if (typeof imageID !== 'string') {
resolve();
}
const imageIDSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(imageID, true)).trim();
if (imageIDSanitized) {
if (!_docker_socket) {
_docker_socket = new DockerSocket();
}
_docker_socket.inspectImage(imageIDSanitized.trim(), data => {
try {
resolve({
id: payload.Id,
container: data.Container,
comment: data.Comment,
os: data.Os,
architecture: data.Architecture,
parent: data.Parent,
dockerVersion: data.DockerVersion,
size: data.Size,
sharedSize: payload.SharedSize,
virtualSize: data.VirtualSize,
author: data.Author,
created: data.Created ? Math.round(new Date(data.Created).getTime() / 1000) : 0,
containerConfig: data.ContainerConfig ? data.ContainerConfig : {},
graphDriver: data.GraphDriver ? data.GraphDriver : {},
repoDigests: data.RepoDigests ? data.RepoDigests : {},
repoTags: data.RepoTags ? data.RepoTags : {},
config: data.Config ? data.Config : {},
rootFS: data.RootFS ? data.RootFS : {},
});
} catch (err) {
resolve();
}
});
} else {
resolve();
}
});
});
}
exports.dockerImages = dockerImages;
function dockerContainers(all, callback) {
function inContainers(containers, id) {

View File

@ -55,6 +55,82 @@ class DockerSocket {
}
}
listImages(all, callback) {
try {
let socket = net.createConnection({ path: socketPath });
let alldata = '';
let data;
socket.on('connect', () => {
socket.write('GET http:/images/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n');
});
socket.on('data', data => {
alldata = alldata + data.toString();
});
socket.on('error', () => {
socket = false;
callback({});
});
socket.on('end', () => {
let startbody = alldata.indexOf('\r\n\r\n');
alldata = alldata.substring(startbody + 4);
socket = false;
try {
data = JSON.parse(alldata);
callback(data);
} catch (err) {
callback({});
}
});
} catch (err) {
callback({});
}
}
inspectImage(id, callback) {
id = id || '';
if (id) {
try {
let socket = net.createConnection({ path: socketPath });
let alldata = '';
let data;
socket.on('connect', () => {
socket.write('GET http:/images/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n');
});
socket.on('data', data => {
alldata = alldata + data.toString();
});
socket.on('error', () => {
socket = false;
callback({});
});
socket.on('end', () => {
let startbody = alldata.indexOf('\r\n\r\n');
alldata = alldata.substring(startbody + 4);
socket = false;
try {
data = JSON.parse(alldata);
callback(data);
} catch (err) {
callback({});
}
});
} catch (err) {
callback({});
}
} else {
callback({});
}
}
listContainers(all, callback) {
try {
@ -91,6 +167,57 @@ class DockerSocket {
}
}
listVolumes(filter, callback) {
try {
let socket = net.createConnection({ path: socketPath });
let alldata = '';
let data;
filter = filter || {};
let filterString = '';
if (filter.dangling && typeof filter.dangling === 'boolean') {
filterString += (filterString ? '&' : '') + 'dangling=true';
}
if (filter.driver && typeof filter.driver === 'string') {
filterString += (filterString ? '&' : '') + `driver=${filter.driver}`;
}
if (filter.label && typeof filter.label === 'string') {
filterString += (filterString ? '&' : '') + `label=${filter.label}`;
}
if (filter.name && typeof filter.name === 'string') {
filterString += (filterString ? '&' : '') + `name=${filter.name}`;
}
socket.on('connect', () => {
socket.write('GET http:/volumes/' + (filterString ? `?${filterString}` : '') + ' HTTP/1.0\r\n\r\n');
});
socket.on('data', data => {
alldata = alldata + data.toString();
});
socket.on('error', () => {
socket = false;
callback({});
});
socket.on('end', () => {
let startbody = alldata.indexOf('\r\n\r\n');
alldata = alldata.substring(startbody + 4);
socket = false;
try {
data = JSON.parse(alldata);
callback(data);
} catch (err) {
callback({});
}
});
} catch (err) {
callback({});
}
}
getStats(id, callback) {
id = id || '';
if (id) {

22
lib/index.d.ts vendored
View File

@ -641,6 +641,27 @@ export namespace Systeminformation {
productLicense: string;
}
interface DockerImageData {
id: string;
container: string;
comment: string;
os: string;
architecture: string;
parent: string;
dockerVersion: string;
size: number;
sharedSize: number;
virtualSize: number;
author: string;
created: number;
containerConfig: any;
graphDriver: any;
repoDigests: any;
repoTags: any;
config: any;
rootFS: any;
}
interface DockerContainerData {
id: string;
name: string;
@ -851,6 +872,7 @@ export function processLoad(processName: string, cb?: (data: Systeminformation.P
export function services(serviceName: string, cb?: (data: Systeminformation.ServicesData[]) => any): Promise<Systeminformation.ServicesData[]>;
export function dockerInfo(cb?: (data: Systeminformation.DockerInfoData) => any): Promise<Systeminformation.DockerInfoData>;
export function dockerImages(all?: boolean, cb?: (data: dockerstats.DockerImageData[]) => any): Promise<dockerstats.DockerImageData[]>;
export function dockerContainers(all?: boolean, cb?: (data: Systeminformation.DockerContainerData[]) => any): Promise<Systeminformation.DockerContainerData[]>;
export function dockerContainerStats(id?: string, cb?: (data: Systeminformation.DockerContainerStatsData[]) => any): Promise<Systeminformation.DockerContainerStatsData[]>;
export function dockerContainerProcesses(id?: string, cb?: (data: any) => any): Promise<any>;

View File

@ -482,6 +482,7 @@ exports.inetChecksite = internet.inetChecksite;
exports.inetLatency = internet.inetLatency;
exports.dockerInfo = docker.dockerInfo;
exports.dockerImages = docker.dockerImages;
exports.dockerContainers = docker.dockerContainers;
exports.dockerContainerStats = docker.dockerContainerStats;
exports.dockerContainerProcesses = docker.dockerContainerProcesses;

View File

@ -49,10 +49,10 @@ function test(f) {
else if (f === '4') { si.networkStats().then(data => { if (data !== null) { resolve({ data, title: 'NET Stats' }); } else { resolve('not_supported'); } }); }
else if (f === '5') { si.networkConnections().then(data => { if (data !== null) { resolve({ data, title: 'NET Connections' }); } else { resolve('not_supported'); } }); }
else if (f === '6') { si.dockerInfo().then(data => { if (data !== null) { resolve({ data, title: 'Docker Info' }); } else { resolve('not_supported'); } }); }
else if (f === '7') { si.dockerContainers(true).then(data => { if (data !== null) { resolve({ data, title: 'Docker Containers' }); } else { resolve('not_supported'); } }); }
else if (f === '8') { si.dockerContainerStats('*').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Stats' }); } else { resolve('not_supported'); } }); }
else if (f === '9') { si.dockerContainerProcesses('*').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Processes' }); } else { resolve('not_supported'); } }); }
else if (f === '0') { si.dockerAll().then(data => { if (data !== null) { resolve({ data, title: 'Docker All' }); } else { resolve('not_supported'); } }); }
else if (f === '7') { si.dockerImages().then(data => { if (data !== null) { resolve({ data, title: 'Docker Images' }); } else { resolve('not_supported'); } }); }
else if (f === '8') { si.dockerContainers(true).then(data => { if (data !== null) { resolve({ data, title: 'Docker Containers' }); } else { resolve('not_supported'); } }); }
else if (f === '9') { si.dockerContainerStats('*').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Stats' }); } else { resolve('not_supported'); } }); }
else if (f === '0') { si.dockerContainerProcesses('*').then(data => { if (data !== null) { resolve({ data, title: 'Docker Cont Processes' }); } else { resolve('not_supported'); } }); }
else if (f === ',') { si.getStaticData().then(data => { if (data !== null) { resolve({ data, title: 'All Static Data' }); } else { resolve('not_supported'); } }); }
else if (f === '.') { si.getDynamicData('apache2, postgres, wsearch').then(data => { if (data !== null) { resolve({ data, title: 'All Dynamic Data' }); } else { resolve('not_supported'); } }); }
else if (f === '/') { si.getAllData('apache2, postgres, wsearch').then(data => { if (data !== null) { resolve({ data, title: 'All Data' }); } else { resolve('not_supported'); } }); }

View File

@ -16,18 +16,19 @@ function printHeader() {
function printMenu() {
console.log('');
console.log('┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐');
console.log('│ a ... Audio h ... Bluetooth s ... Services Y ... Battery ? ... Get Object │');
console.log('│ b ... BIOS i ... INET Latency S ... Shell z ... Users , ... All Static │');
console.log('│ B ... Baseboard I ... INET Check Site t ... time 1 ... NET Iface Default . ... All Dynamic │');
console.log('│ C ... Chassis j ... CPU Current Speed T ... CPU Temperature 2 ... NET Gateway Default / ... All │');
console.log('│ c ... CPU l ... CPU Current Load u ... USB 3 ... NET Interfaces │');
console.log('│ d ... DiskLayout L ... Full Load U ... UUID 4 ... NET Stats │');
console.log('│ D ... DiskIO m ... Memory v ... Versions 5 ... NET Connections │');
console.log('│ e ... Block Devices M ... MEM Layout V ... Virtual Box 6 ... Docker Info │');
console.log('│ E ... Open Files o ... OS Info w ... WIFI networks 7 ... Docker Container │');
console.log('│ f ... FS Size p ... Processes W ... WIFI interfaces 8 ... Docker Cont Stats │');
console.log('│ F ... FS Stats P ... Process Load x ... WIFI connections 9 ... Docker Cont Proc │');
console.log('│ g ... Graphics r ... Printer y ... System 0 ... Docker All q >>> QUIT │');
console.log('│ a ... Audio i ... INET Latency t ... time 1 ... NET Iface Default ? ... Get Object │');
console.log('│ b ... BIOS I ... INET Check Site T ... CPU Temperature 2 ... NET Gateway Default , ... All Static │');
console.log('│ B ... Baseboard j ... CPU Current Speed u ... USB 3 ... NET Interfaces . ... All Dynamic │');
console.log('│ C ... Chassis l ... CPU Current Load U ... UUID 4 ... NET Stats / ... All │');
console.log('│ c ... CPU L ... Full Load v ... Versions 5 ... NET Connections │');
console.log('│ d ... DiskLayout m ... Memory V ... Virtual Box │');
console.log('│ D ... DiskIO M ... MEM Layout w ... WIFI networks │');
console.log('│ e ... Block Devices o ... OS Info W ... WIFI interfaces │');
console.log('│ E ... Open Files p ... Processes x ... WIFI connections 6 ... Docker Info │');
console.log('│ f ... FS Size P ... Process Load y ... System 7 ... Docker Images │');
console.log('│ F ... FS Stats r ... Printer Y ... Battery 8 ... Docker Container │');
console.log('│ g ... Graphics s ... Services z ... Users 9 ... Docker Cont Stats │');
console.log('│ h ... Bluetooth S ... Shell 0 ... Docker Cont Proc q >>> QUIT │');
console.log('└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘');
}