Skip to content

Commit 1bd9160

Browse files
committed
Implemented createContainer and getContainers
1 parent cf4f738 commit 1bd9160

13 files changed

Lines changed: 7109 additions & 0 deletions

File tree

.github/workflows/on-push.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: On Push
2+
on: [push]
3+
jobs:
4+
build:
5+
name: Build & Test
6+
runs-on: Linux
7+
steps:
8+
- name: Checking out repository
9+
uses: actions/checkout@v4
10+
- name: "Setup Node"
11+
uses: actions/setup-node@v4
12+
with:
13+
node-version: '22'
14+
cache: 'npm'
15+
- name: Installing
16+
run: npm install
17+
- name: Building
18+
run: npm run build
19+
- name: Linting
20+
run: npm run lint
21+
- name: Testing
22+
run: npm run test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
lib/
3+
coverage/

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 120,
3+
"trailingComma": "all",
4+
"singleQuote": true
5+
}

README.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
![GitHub package.json version](https://img.shields.io/github/package-json/v/LupCode/node-lup-docker)
2+
![npm bundle size](https://img.shields.io/bundlephobia/min/lup-docker)
3+
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/LupCode/node-lup-docker/on-push.yml?branch=main)
4+
![NPM](https://img.shields.io/npm/l/lup-docker)
5+
6+
# lup-docker
7+
NodeJS library to interact with the Docker engine.
8+
9+
## Example
10+
11+
JavaScript:
12+
```javascript
13+
const Docker = require('lup-docker');
14+
15+
Docker..getCpuInfo().then(cpuInfo => console.log("CPU Info: " + cpuInfo));
16+
```
17+
18+
TypeScript:
19+
```typescript
20+
import lupSystem from 'lup-docker';
21+
22+
(async () => {
23+
console.log("CPU Info: ", await lupSystem.getCpuInfo());
24+
console.log("Drives: ", await lupSystem.getDrives()); // Array of drive objects
25+
console.log("GPU Info: ", await lupSystem.getGPUs());
26+
console.log("Memory Info: ", await lupSystem.getMemoryInfo());
27+
console.log("Network Interfaces: ", await lupSystem.getNetworkInterfaces());
28+
console.log("OS Info: ", await lupSystem.getOSInfo());
29+
console.log("Temperatures: ", await lupSystem.getTemperatures());
30+
})();
31+
```
32+
33+
Output:
34+
```
35+
CPU Info: {
36+
architecture: 'x64',
37+
coreCount: 12,
38+
endian: 'LE',
39+
name: '11th Gen Intel(R) Core(TM) i5-11600K @ 3.90GHz',
40+
speed: 3912,
41+
utilization: {
42+
overall: 0.20021299254526093,
43+
cores: [
44+
0.20253164556962025,
45+
0.19230769230769232,
46+
0.6025641025641025,
47+
0,
48+
0.3974358974358974,
49+
0.20253164556962025,
50+
0,
51+
0,
52+
0.20253164556962025,
53+
0,
54+
0.19480519480519481,
55+
0.4050632911392405
56+
]
57+
}
58+
}
59+
Drives: [
60+
{
61+
filesystem: 'C:',
62+
mount: 'C:',
63+
type: 'ntfs',
64+
total: 1999519543296,
65+
utilization: {
66+
free: 470568960000,
67+
used: 1528950583296,
68+
percentage: 0.7646589844156682
69+
}
70+
},
71+
{
72+
filesystem: 'D:',
73+
mount: 'D:',
74+
type: 'ntfs',
75+
total: 1000203087872,
76+
utilization: {
77+
free: 917100240896,
78+
used: 83102846976,
79+
percentage: 0.08308597322250519
80+
}
81+
}
82+
]
83+
GPU Info: [
84+
{
85+
name: 'NVIDIA GeForce RTX 3060 Ti',
86+
status: 'ok',
87+
id: 'PCI\\VEN_10DE&DEV_2489&SUBSYS_884F1043&REV_A1\\4&2130FF93&0&0008',
88+
processor: 'NVIDIA GeForce RTX 3060 Ti',
89+
memory: 8589934592,
90+
driverDate: '14.05.2025 02:00:00',
91+
driverVersion: '32.0.15.7652',
92+
displayAttached: true,
93+
displayActive: true,
94+
utilization: {
95+
fanSpeed: 0.56,
96+
processing: 0.01,
97+
memory: 0,
98+
temperature: 51,
99+
powerDraw: 46.65
100+
}
101+
}
102+
]
103+
Memory Info: {
104+
size: 34249633792,
105+
utilization: {
106+
used: 22643089408,
107+
free: 11606544384,
108+
percentage: 0.6611191683249166
109+
},
110+
devices: [
111+
{
112+
manufacturer: 'Kingston',
113+
model: 'KF3200C16D4/16GX',
114+
bankName: 'BANK 0',
115+
size: 17179869184,
116+
busWidth: 64,
117+
maxClockSpeed: 2400,
118+
clockSpeed: 2400,
119+
voltage: 1.2,
120+
locator: 'Controller0-ChannelA-DIMM1',
121+
type: 'DDR4',
122+
transfersPerClockCycle: 2,
123+
bandwidth: 38400000000
124+
},
125+
{
126+
manufacturer: 'Kingston',
127+
model: 'KF3200C16D4/16GX',
128+
bankName: 'BANK 1',
129+
size: 17179869184,
130+
busWidth: 64,
131+
maxClockSpeed: 2400,
132+
clockSpeed: 2400,
133+
voltage: 1.2,
134+
locator: 'Controller0-ChannelB-DIMM1',
135+
type: 'DDR4',
136+
transfersPerClockCycle: 2,
137+
bandwidth: 38400000000
138+
}
139+
],
140+
bandwidth: 76800000000
141+
}
142+
Network Interfaces: [
143+
{
144+
name: 'Loopback Pseudo-Interface 1',
145+
addresses: [ [Object], [Object] ],
146+
status: { operational: 'unknown', admin: true, cable: false },
147+
physical: true
148+
},
149+
{
150+
name: 'Ethernet',
151+
addresses: [],
152+
status: { operational: 'up', admin: true, cable: true },
153+
physical: true,
154+
speed: { bits: 1000000000, bytes: 125000000 },
155+
utilization: {
156+
receive: 0.000003003690036900369,
157+
transmit: 4.723247232472324e-7
158+
}
159+
}
160+
]
161+
OS Info: {
162+
name: 'Windows',
163+
version: '10.0.26100',
164+
architecture: 'x64',
165+
machine: 'x86_64',
166+
platform: 'win32',
167+
bits: 64,
168+
hostname: 'my-pc',
169+
uptime: 2025-07-25T09:38:27.126Z
170+
}
171+
Temperatures: {
172+
cpu: 45.2,
173+
gpu: 60.8,
174+
}
175+
```
176+
177+
178+
## Considerations
179+
180+
### GPU Readings
181+
For more detailed information on GPUs it is recommended to
182+
install the [nvidia-smi](https://developer.nvidia.com/nvidia-system-management-interface) tool.
183+
184+
### Docker
185+
For [Docker](https://www.docker.com/) support, ensure that the Docker daemon is running and accessible.

jestconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"transform": {
3+
"^.+\\.(t|j)sx?$": "ts-jest"
4+
},
5+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
6+
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
7+
"collectCoverage":true
8+
}

0 commit comments

Comments
 (0)