@dockstat/docker 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2442 @@
1
+ declare module "modules/base/types" {
2
+ import type { TLSOptions } from "bun";
3
+ export type ConnectionMode = "unix" | "tcp";
4
+ export interface ConnectionConfig {
5
+ mode: ConnectionMode;
6
+ socketPath?: string;
7
+ baseUrl?: string;
8
+ tls?: TLSOptions;
9
+ dockerAPIVersion?: string;
10
+ }
11
+ export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "HEAD";
12
+ }
13
+ declare module "utils/request-options" {
14
+ import type { BodyInit, HeadersInit } from "bun";
15
+ import type { ConnectionConfig, HttpMethod } from "modules/base/types";
16
+ export function prepareRequestOptions(config: ConnectionConfig, method: HttpMethod, body?: BodyInit | object, headers?: HeadersInit, url?: string): BunFetchRequestInit;
17
+ }
18
+ declare module "utils/error" {
19
+ export class DockerError extends Error {
20
+ status: number;
21
+ path: string;
22
+ version: string;
23
+ params: object | string;
24
+ constructor(message: string, status: number, path: string, version: string, params: object | string);
25
+ }
26
+ }
27
+ declare module "utils/response" {
28
+ export function handleDockerResponse(response: Response, path: string, apiVersion: string, params: object | undefined): Promise<Response>;
29
+ }
30
+ declare module "utils/url" {
31
+ import type { ConnectionConfig } from "modules/base/types";
32
+ /**
33
+ * Converts an object of parameters into a URL query string.
34
+ * Handles strings, numbers, booleans, and JSON serializable objects.
35
+ */
36
+ export function buildQueryString(params?: object): string | undefined;
37
+ /**
38
+ * Constructs the full request URL based on the connection mode (Unix/Http) and API version.
39
+ */
40
+ export function buildDockerUrl(config: ConnectionConfig, path: string, query: string | undefined, apiVersion: string): string;
41
+ }
42
+ declare module "modules/_socket/index" {
43
+ /**
44
+ * WebSocket-like interface for Docker container attach
45
+ * Uses the attach endpoint with stream wrapping for compatibility with Unix sockets
46
+ *
47
+ * @note Currently supports read-only operations (receiving stdout/stderr). Full WebSocket
48
+ * protocol support with bidirectional communication is planned for future versions.
49
+ */
50
+ export class DockerWebSocket {
51
+ private static readonly CONNECTING;
52
+ private static readonly OPEN;
53
+ private static readonly CLOSING;
54
+ private static readonly CLOSED;
55
+ private readyStateValue;
56
+ private listeners;
57
+ private reader;
58
+ addEventListener(type: string, listener: (event: unknown) => void): void;
59
+ removeEventListener(type: string, listener: (event: unknown) => void): void;
60
+ attach(response: Response): Promise<void>;
61
+ close(): void;
62
+ get CONNECTING(): number;
63
+ get OPEN(): number;
64
+ get CLOSING(): number;
65
+ get CLOSED(): number;
66
+ get readyState(): number;
67
+ private emit;
68
+ }
69
+ }
70
+ declare module "modules/base/index" {
71
+ import type { BodyInit, HeadersInit } from "bun";
72
+ import { DockerWebSocket } from "modules/_socket/index";
73
+ import type { ConnectionConfig, HttpMethod } from "modules/base/types";
74
+ export class BaseModule {
75
+ private config;
76
+ constructor(config: ConnectionConfig);
77
+ protected ws: DockerWebSocket;
78
+ request(path: string, method?: HttpMethod, body?: BodyInit | object, headers?: HeadersInit, params?: object): Promise<Response>;
79
+ }
80
+ }
81
+ declare module "modules/container/types" {
82
+ /**
83
+ * Container summary information
84
+ */
85
+ export interface ContainerSummary {
86
+ Id: string;
87
+ Names: string[];
88
+ Image: string;
89
+ ImageID: string;
90
+ Command: string;
91
+ Created: number;
92
+ Ports: Port[];
93
+ SizeRw?: number;
94
+ SizeRootFs?: number;
95
+ Labels?: Record<string, string>;
96
+ State: string;
97
+ Status: string;
98
+ HostConfig?: {
99
+ NetworkMode: string;
100
+ Annotations?: Record<string, string>;
101
+ };
102
+ NetworkSettings?: {
103
+ Networks?: Record<string, NetworkSummary>;
104
+ };
105
+ Mounts?: Mount[];
106
+ Health?: Health;
107
+ }
108
+ /**
109
+ * Detailed container information
110
+ */
111
+ export interface ContainerInspectResponse {
112
+ Id: string;
113
+ Created: string;
114
+ Path: string;
115
+ Args: string[];
116
+ State: ContainerState;
117
+ Image: string;
118
+ ResolvConfPath: string;
119
+ HostnamePath: string;
120
+ HostsPath: string;
121
+ LogPath: string;
122
+ Name: string;
123
+ RestartCount: number;
124
+ Driver: string;
125
+ Platform: string;
126
+ MountLabel: string;
127
+ ProcessLabel: string;
128
+ AppArmorProfile: string;
129
+ ExecIDs: string[];
130
+ HostConfig: HostConfig;
131
+ GraphDriver: GraphDriver;
132
+ SizeRw?: number;
133
+ SizeRootFs?: number;
134
+ Mounts?: Mount[];
135
+ Config: ContainerConfig;
136
+ NetworkSettings: NetworkSettings;
137
+ }
138
+ /**
139
+ * Container state information
140
+ */
141
+ export interface ContainerState {
142
+ Status: string;
143
+ Running: boolean;
144
+ Paused: boolean;
145
+ Restarting: boolean;
146
+ OOMKilled: boolean;
147
+ Dead: boolean;
148
+ Pid?: number;
149
+ ExitCode?: number;
150
+ Error?: string;
151
+ StartedAt?: string;
152
+ FinishedAt?: string;
153
+ Health?: Health;
154
+ }
155
+ /**
156
+ * Container configuration
157
+ */
158
+ export interface ContainerConfig {
159
+ Hostname: string;
160
+ Domainname: string;
161
+ User?: string;
162
+ AttachStdin: boolean;
163
+ AttachStdout: boolean;
164
+ AttachStderr: boolean;
165
+ ExposedPorts?: Record<string, object> | null;
166
+ Tty: boolean;
167
+ OpenStdin: boolean;
168
+ StdinOnce: boolean;
169
+ Env?: string[];
170
+ Cmd?: string[];
171
+ Healthcheck?: HealthConfig;
172
+ ArgsEscaped: boolean | null;
173
+ Image: string;
174
+ Volumes?: Record<string, object>;
175
+ WorkingDir: string;
176
+ Entrypoint?: string[];
177
+ NetworkDisabled?: boolean;
178
+ MacAddress?: string;
179
+ OnBuild?: string[];
180
+ Labels?: Record<string, string>;
181
+ StopSignal?: string;
182
+ StopTimeout?: number;
183
+ Shell?: string[];
184
+ }
185
+ /**
186
+ * Host configuration
187
+ */
188
+ export interface HostConfig {
189
+ Binds?: string[];
190
+ ContainerIDFile?: string;
191
+ LogConfig?: LogConfig;
192
+ NetworkMode?: string;
193
+ PortBindings?: Record<string, PortBinding[]>;
194
+ RestartPolicy?: RestartPolicy;
195
+ AutoRemove?: boolean;
196
+ VolumeDriver?: string;
197
+ VolumesFrom?: string[];
198
+ CapAdd?: string[];
199
+ CapDrop?: string[];
200
+ CgroupnsMode?: string;
201
+ Dns?: string[];
202
+ DnsOptions?: string[];
203
+ DnsSearch?: string[];
204
+ ExtraHosts?: string[];
205
+ GroupAdd?: string[];
206
+ IpcMode?: string;
207
+ Cgroup?: string;
208
+ Links?: string[];
209
+ OomScoreAdj?: number;
210
+ PidMode?: string;
211
+ Privileged?: boolean;
212
+ PublishAllPorts?: boolean;
213
+ ReadonlyRootfs?: boolean;
214
+ SecurityOpt?: string[];
215
+ StorageOpt?: Record<string, string>;
216
+ Tmpfs?: Record<string, string>;
217
+ UTSMode?: string;
218
+ UsernsMode?: string;
219
+ ShmSize?: number;
220
+ Sysctls?: Record<string, string>;
221
+ Runtime?: string;
222
+ ConsoleSize?: number[];
223
+ Isolation?: string;
224
+ Resources?: Resources;
225
+ MaskedPaths?: string[];
226
+ ReadonlyPaths?: string[];
227
+ }
228
+ /**
229
+ * Container stats
230
+ */
231
+ export interface ContainerStatsResponse {
232
+ id?: string;
233
+ name?: string;
234
+ os_type?: string;
235
+ read: string;
236
+ cpu_stats: ContainerCPUStats;
237
+ memory_stats: ContainerMemoryStats;
238
+ networks?: Record<string, ContainerNetworkStats>;
239
+ pids_stats?: ContainerPidsStats;
240
+ blkio_stats: ContainerBlkioStats;
241
+ num_procs?: number;
242
+ storage_stats?: ContainerStorageStats;
243
+ }
244
+ /**
245
+ * CPU stats
246
+ */
247
+ export interface ContainerCPUStats {
248
+ cpu_usage: ContainerCPUUsage;
249
+ system_cpu_usage: number;
250
+ online_cpus?: number;
251
+ throttling_data?: ContainerThrottlingData;
252
+ }
253
+ /**
254
+ * CPU usage
255
+ */
256
+ export interface ContainerCPUUsage {
257
+ total_usage: number;
258
+ percpu_usage?: number[];
259
+ usage_in_kernelmode: number;
260
+ usage_in_usermode: number;
261
+ }
262
+ /**
263
+ * Throttling data
264
+ */
265
+ export interface ContainerThrottlingData {
266
+ periods: number;
267
+ throttled_periods: number;
268
+ throttled_time: number;
269
+ }
270
+ /**
271
+ * Memory stats
272
+ */
273
+ export interface ContainerMemoryStats {
274
+ usage: number;
275
+ max_usage?: number;
276
+ stats?: Record<string, number>;
277
+ failcnt?: number;
278
+ limit: number;
279
+ commitbytes?: number;
280
+ commitpeakbytes?: number;
281
+ privateworkingset?: number;
282
+ }
283
+ /**
284
+ * PIDs stats
285
+ */
286
+ export interface ContainerPidsStats {
287
+ current?: number;
288
+ limit?: number;
289
+ }
290
+ /**
291
+ * Block I/O stats
292
+ */
293
+ export interface ContainerBlkioStats {
294
+ io_service_bytes_recursive?: ContainerBlkioStatEntry[];
295
+ io_serviced_recursive?: ContainerBlkioStatEntry[];
296
+ io_queue_recursive?: ContainerBlkioStatEntry[];
297
+ io_service_time_recursive?: ContainerBlkioStatEntry[];
298
+ io_wait_time_recursive?: ContainerBlkioStatEntry[];
299
+ io_merged_recursive?: ContainerBlkioStatEntry[];
300
+ io_time_recursive?: ContainerBlkioStatEntry[];
301
+ sectors_recursive?: ContainerBlkioStatEntry[];
302
+ }
303
+ /**
304
+ * Block I/O stat entry
305
+ */
306
+ export interface ContainerBlkioStatEntry {
307
+ major: number;
308
+ minor: number;
309
+ op: string;
310
+ value: number;
311
+ }
312
+ /**
313
+ * Network stats
314
+ */
315
+ export interface ContainerNetworkStats {
316
+ rx_bytes: number;
317
+ rx_packets: number;
318
+ rx_errors: number;
319
+ rx_dropped: number;
320
+ tx_bytes: number;
321
+ tx_packets: number;
322
+ tx_errors: number;
323
+ tx_dropped: number;
324
+ }
325
+ /**
326
+ * Storage stats
327
+ */
328
+ export interface ContainerStorageStats {
329
+ read_count_normalized?: number;
330
+ read_size_bytes?: number;
331
+ write_count_normalized?: number;
332
+ write_size_bytes?: number;
333
+ }
334
+ /**
335
+ * Top processes
336
+ */
337
+ export interface ContainerTopResponse {
338
+ Titles: string[];
339
+ Processes: string[][];
340
+ }
341
+ /**
342
+ * Wait response
343
+ */
344
+ export interface ContainerWaitResponse {
345
+ StatusCode: number;
346
+ Error?: ContainerWaitExitError;
347
+ }
348
+ /**
349
+ * Wait exit error
350
+ */
351
+ export interface ContainerWaitExitError {
352
+ Message: string;
353
+ }
354
+ /**
355
+ * Create container response
356
+ */
357
+ export interface ContainerCreateResponse {
358
+ Id: string;
359
+ Warnings?: string[];
360
+ }
361
+ /**
362
+ * Update container response
363
+ */
364
+ export interface ContainerUpdateResponse {
365
+ Warnings?: string[];
366
+ }
367
+ /**
368
+ * Container prune response
369
+ */
370
+ export interface ContainerPruneResponse {
371
+ ContainersDeleted?: string[];
372
+ SpaceReclaimed: number;
373
+ }
374
+ /**
375
+ * Health status
376
+ */
377
+ export interface Health {
378
+ Status: string;
379
+ FailingStreak?: number;
380
+ Log?: HealthcheckResult[];
381
+ }
382
+ /**
383
+ * Health check configuration
384
+ */
385
+ export interface HealthConfig {
386
+ Test?: string[];
387
+ Interval?: number;
388
+ Timeout?: number;
389
+ Retries?: number;
390
+ StartPeriod?: number;
391
+ StartInterval?: number;
392
+ }
393
+ /**
394
+ * Health check result
395
+ */
396
+ export interface HealthcheckResult {
397
+ Start: string;
398
+ End: string;
399
+ ExitCode: number;
400
+ Output: string;
401
+ }
402
+ /**
403
+ * Port
404
+ */
405
+ export interface Port {
406
+ IP: string;
407
+ PrivatePort: number;
408
+ PublicPort?: number;
409
+ Type: string;
410
+ }
411
+ /**
412
+ * Port binding
413
+ */
414
+ export interface PortBinding {
415
+ HostIp: string;
416
+ HostPort: string;
417
+ }
418
+ /**
419
+ * Restart policy
420
+ */
421
+ export interface RestartPolicy {
422
+ Name: string;
423
+ MaximumRetryCount?: number;
424
+ }
425
+ /**
426
+ * Resources
427
+ */
428
+ export interface Resources {
429
+ CpuShares?: number;
430
+ Memory?: number;
431
+ NanoCpus?: number;
432
+ CpuPeriod?: number;
433
+ CpuQuota?: number;
434
+ CpuRealtimePeriod?: number;
435
+ CpuRealtimeRuntime?: number;
436
+ CpusetCpus?: string;
437
+ CpusetMems?: string;
438
+ BlkioWeight?: number;
439
+ BlkioWeightDevice?: {
440
+ Path: string;
441
+ Weight: number;
442
+ }[];
443
+ BlkioDeviceReadBps?: {
444
+ Path: string;
445
+ Rate: number;
446
+ }[];
447
+ BlkioDeviceWriteBps?: {
448
+ Path: string;
449
+ Rate: number;
450
+ }[];
451
+ BlkioDeviceReadIOps?: {
452
+ Path: string;
453
+ Rate: number;
454
+ }[];
455
+ BlkioDeviceWriteIOps?: {
456
+ Path: string;
457
+ Rate: number;
458
+ }[];
459
+ MemoryReservation?: number;
460
+ MemorySwap?: number;
461
+ MemorySwappiness?: number;
462
+ OomKillDisable?: boolean;
463
+ PidsLimit?: number;
464
+ Ulimits?: {
465
+ Name: string;
466
+ Soft: number;
467
+ Hard: number;
468
+ }[];
469
+ }
470
+ /**
471
+ * Graph driver
472
+ */
473
+ export interface GraphDriver {
474
+ Name: string;
475
+ Data: Record<string, string>;
476
+ }
477
+ /**
478
+ * Mount
479
+ */
480
+ export interface Mount {
481
+ Type: string;
482
+ Name?: string;
483
+ Source?: string;
484
+ Destination: string;
485
+ Driver?: string;
486
+ Mode?: string;
487
+ RW?: boolean;
488
+ Propagation?: string;
489
+ }
490
+ /**
491
+ * Log config
492
+ */
493
+ export interface LogConfig {
494
+ Type: string;
495
+ Config?: Record<string, string>;
496
+ }
497
+ /**
498
+ * Network settings
499
+ */
500
+ export interface NetworkSettings {
501
+ SandboxID: string;
502
+ SandboxKey: string;
503
+ Ports?: Record<string, PortBinding[]>;
504
+ Networks?: Record<string, NetworkSummary>;
505
+ }
506
+ /**
507
+ * Network summary
508
+ */
509
+ export interface NetworkSummary {
510
+ EndpointID?: string;
511
+ Gateway?: string;
512
+ IPAddress?: string;
513
+ IPPrefixLen?: number;
514
+ IPv6Gateway?: string;
515
+ GlobalIPv6Address?: string;
516
+ GlobalIPv6PrefixLen?: number;
517
+ MacAddress?: string;
518
+ NetworkID?: string;
519
+ }
520
+ /**
521
+ * Filesystem change
522
+ */
523
+ export interface FilesystemChange {
524
+ Path: string;
525
+ Kind: number;
526
+ }
527
+ /**
528
+ * Exec create options
529
+ */
530
+ export interface ExecCreateOptions {
531
+ AttachStdin?: boolean;
532
+ AttachStdout?: boolean;
533
+ AttachStderr?: boolean;
534
+ DetachKeys?: string;
535
+ Tty?: boolean;
536
+ Env?: string[];
537
+ Cmd?: string[];
538
+ Privileged?: boolean;
539
+ User?: string;
540
+ WorkingDir?: string;
541
+ }
542
+ /**
543
+ * Exec create response
544
+ */
545
+ export interface ExecCreateResponse {
546
+ Id: string;
547
+ }
548
+ /**
549
+ * Exec start options
550
+ */
551
+ export interface ExecStartOptions {
552
+ Detach?: boolean;
553
+ Tty?: boolean;
554
+ ConsoleSize?: number[];
555
+ }
556
+ /**
557
+ * Exec inspect response
558
+ */
559
+ export interface ExecInspectResponse {
560
+ CanRemove: boolean;
561
+ DetachKeys: string;
562
+ ID: string;
563
+ Running: boolean;
564
+ ExitCode: number;
565
+ ProcessConfig: {
566
+ arguments: string[];
567
+ entrypoint: string;
568
+ privileged: boolean;
569
+ tty: boolean;
570
+ user: string;
571
+ };
572
+ OpenStdin: boolean;
573
+ OpenStderr: boolean;
574
+ OpenStdout: boolean;
575
+ ContainerID: string;
576
+ Pid: number;
577
+ }
578
+ /**
579
+ * Archive info
580
+ */
581
+ export interface ArchiveInfo {
582
+ name: string;
583
+ size: number;
584
+ mode: number;
585
+ mtime: string;
586
+ linkTarget?: string;
587
+ }
588
+ /**
589
+ * Network config
590
+ */
591
+ export interface NetworkingConfig {
592
+ EndpointsConfig?: Record<string, EndpointSettings>;
593
+ }
594
+ /**
595
+ * Endpoint settings
596
+ */
597
+ export interface EndpointSettings {
598
+ IPAMConfig?: {
599
+ IPv4Address?: string;
600
+ IPv6Address?: string;
601
+ LinkLocalIPs?: string[];
602
+ };
603
+ Links?: string[];
604
+ Aliases?: string[];
605
+ NetworkID?: string;
606
+ EndpointID?: string;
607
+ Gateway?: string;
608
+ IPAddress?: string;
609
+ IPPrefixLen?: number;
610
+ IPv6Gateway?: string;
611
+ GlobalIPv6Address?: string;
612
+ GlobalIPv6PrefixLen?: number;
613
+ MacAddress?: string;
614
+ DriverOpts?: Record<string, string>;
615
+ }
616
+ /**
617
+ * List containers options
618
+ */
619
+ export interface ListContainersOptions {
620
+ all?: boolean;
621
+ limit?: number;
622
+ size?: boolean;
623
+ filters?: {
624
+ ancestor?: string[];
625
+ before?: string[];
626
+ expose?: string[];
627
+ exited?: number[];
628
+ health?: string[];
629
+ id?: string[];
630
+ isolation?: string[];
631
+ label?: string[];
632
+ name?: string[];
633
+ network?: string[];
634
+ publish?: string[];
635
+ since?: string[];
636
+ status?: string[];
637
+ volume?: string[];
638
+ };
639
+ }
640
+ /**
641
+ * Create container options
642
+ */
643
+ export interface CreateContainerOptions {
644
+ name?: string;
645
+ platform?: string;
646
+ HostConfig?: HostConfig;
647
+ NetworkingConfig?: NetworkingConfig;
648
+ }
649
+ /**
650
+ * Update container options
651
+ */
652
+ export interface UpdateContainerOptions {
653
+ BlkioWeight?: number;
654
+ CpuShares?: number;
655
+ CpuPeriod?: number;
656
+ CpuQuota?: number;
657
+ CpuRealtimePeriod?: number;
658
+ CpuRealtimeRuntime?: number;
659
+ CpusetCpus?: string;
660
+ CpusetMems?: string;
661
+ Memory?: number;
662
+ MemorySwap?: number;
663
+ MemoryReservation?: number;
664
+ RestartPolicy?: RestartPolicy;
665
+ }
666
+ /**
667
+ * Attach options
668
+ */
669
+ export interface AttachOptions {
670
+ detachKeys?: string;
671
+ log?: boolean;
672
+ stream?: boolean;
673
+ stdin?: boolean;
674
+ stdout?: boolean;
675
+ stderr?: boolean;
676
+ }
677
+ /**
678
+ * Logs options
679
+ */
680
+ export interface LogsOptions {
681
+ follow?: boolean;
682
+ stdout?: boolean;
683
+ stderr?: boolean;
684
+ since?: number;
685
+ until?: number;
686
+ timestamps?: boolean;
687
+ tail?: string;
688
+ }
689
+ /**
690
+ * Wait condition
691
+ */
692
+ export type WaitCondition = "not-running" | "next-exit" | "removed";
693
+ /**
694
+ * Prune containers options
695
+ */
696
+ export interface PruneContainersOptions {
697
+ filters?: {
698
+ label?: string[];
699
+ until?: string;
700
+ };
701
+ }
702
+ /**
703
+ * Stats options
704
+ */
705
+ export interface StatsOptions {
706
+ stream?: boolean;
707
+ "one-shot"?: boolean;
708
+ }
709
+ /**
710
+ * Change type
711
+ */
712
+ export enum ChangeType {
713
+ Modified = 0,
714
+ Added = 1,
715
+ Deleted = 2
716
+ }
717
+ }
718
+ declare module "modules/container/index" {
719
+ import type { BodyInit } from "bun";
720
+ import { BaseModule } from "modules/base/index";
721
+ import type { DockerWebSocket } from "modules/_socket/index";
722
+ import type { ArchiveInfo, AttachOptions, ContainerConfig, ContainerCreateResponse, ContainerInspectResponse, ContainerPruneResponse, ContainerStatsResponse, ContainerSummary, ContainerTopResponse, ContainerUpdateResponse, ContainerWaitResponse, CreateContainerOptions, ExecCreateOptions, ExecCreateResponse, ExecInspectResponse, ExecStartOptions, FilesystemChange, ListContainersOptions, LogsOptions, PruneContainersOptions, StatsOptions, UpdateContainerOptions, WaitCondition } from "modules/container/types";
723
+ /**
724
+ * Container Module - handles all Docker container operations
725
+ */
726
+ export class ContainerModule extends BaseModule {
727
+ /**
728
+ * List containers
729
+ * @param options - List options
730
+ * @returns Array of container summaries
731
+ */
732
+ list(options?: ListContainersOptions): Promise<ContainerSummary[]>;
733
+ /**
734
+ * Create a container
735
+ * @param config - Container configuration
736
+ * @param options - Create options
737
+ * @returns Container create response with ID
738
+ */
739
+ create(config: ContainerConfig, options?: CreateContainerOptions): Promise<ContainerCreateResponse>;
740
+ /**
741
+ * Inspect a container
742
+ * @param id - Container ID or name
743
+ * @param size - Return container size information
744
+ * @returns Detailed container information
745
+ */
746
+ inspect(id: string, size?: boolean): Promise<ContainerInspectResponse>;
747
+ /**
748
+ * Start a container
749
+ * @param id - Container ID or name
750
+ * @param detachKeys - Override the key sequence for detaching
751
+ */
752
+ start(id: string, detachKeys?: string): Promise<void>;
753
+ /**
754
+ * Stop a container
755
+ * @param id - Container ID or name
756
+ * @param t - Number of seconds to wait before killing the container
757
+ */
758
+ stop(id: string, t?: number): Promise<void>;
759
+ /**
760
+ * Restart a container
761
+ * @param id - Container ID or name
762
+ * @param t - Number of seconds to wait before killing the container
763
+ */
764
+ restart(id: string, t?: number): Promise<void>;
765
+ /**
766
+ * Kill a container
767
+ * @param id - Container ID or name
768
+ * @param signal - Signal to send to the container
769
+ */
770
+ kill(id: string, signal?: string): Promise<void>;
771
+ /**
772
+ * Remove a container
773
+ * @param id - Container ID or name
774
+ * @param v - Remove anonymous volumes associated with the container
775
+ * @param force - Force removal of running containers
776
+ * @param link - Remove the specified link associated with the container
777
+ */
778
+ remove(id: string, v?: boolean, force?: boolean, link?: boolean): Promise<void>;
779
+ /**
780
+ * Rename a container
781
+ * @param id - Container ID or name
782
+ * @param name - New name for the container
783
+ */
784
+ rename(id: string, name: string): Promise<void>;
785
+ /**
786
+ * Pause a container
787
+ * @param id - Container ID or
788
+ name
789
+ */
790
+ pause(id: string): Promise<void>;
791
+ /**
792
+ * Unpause a container
793
+ * @param id - Container ID or name
794
+ */
795
+ unpause(id: string): Promise<void>;
796
+ /**
797
+ * Wait for a container
798
+ * @param id - Container ID or name
799
+ * @param condition - Wait until condition is met
800
+ * @returns Container wait response with exit status
801
+ */
802
+ wait(id: string, condition?: WaitCondition): Promise<ContainerWaitResponse>;
803
+ /**
804
+ * List processes running inside a container
805
+ * @param id - Container ID or name
806
+ * @param ps_args - Arguments for ps command
807
+ * @returns Top processes response
808
+ */
809
+ top(id: string, ps_args?: string): Promise<ContainerTopResponse>;
810
+ /**
811
+ * Get container logs
812
+ * @param id - Container ID or name
813
+ * @param options - Log options
814
+ * @returns Log stream
815
+ */
816
+ logs(id: string, options?: LogsOptions): Promise<Response>;
817
+ /**
818
+ * Get container resource usage statistics
819
+ * @param id - Container ID or name
820
+ * @param options - Stats options
821
+ * @returns Container stats response
822
+ */
823
+ stats(id: string, options?: StatsOptions): Promise<ContainerStatsResponse | Response>;
824
+ /**
825
+ * Get changes on container filesystem
826
+ * @param id - Container ID or name
827
+ * @returns Array of filesystem changes
828
+ */
829
+ changes(id: string): Promise<FilesystemChange[]>;
830
+ /**
831
+ * Export a container
832
+ * @param id - Container ID or name
833
+ * @returns Exported container archive
834
+ */
835
+ export(id: string): Promise<Response>;
836
+ /**
837
+ * Update container configuration
838
+ * @param id - Container ID or name
839
+ * @param options - Update options
840
+ * @returns Update response with warnings
841
+ */
842
+ update(id: string, options: UpdateContainerOptions): Promise<ContainerUpdateResponse>;
843
+ /**
844
+ * Resize container TTY
845
+ * @param id - Container ID or name
846
+ * @param h - Height of the TTY session
847
+ * @param w - Width of the TTY session
848
+ */
849
+ resize(id: string, h: number, w: number): Promise<void>;
850
+ /**
851
+ * Attach to a container
852
+ * @param id - Container ID or name
853
+ * @param options - Attach options
854
+ * @returns Attach connection
855
+ */
856
+ attach(id: string, options?: AttachOptions): Promise<Response>;
857
+ /**
858
+ * Attach to a container via WebSocket
859
+ * @param id - Container ID or name
860
+ * @param options - Attach options
861
+ * @returns WebSocket-like connection
862
+ * @note Uses the attach endpoint with stream wrapping for compatibility with Unix sockets
863
+ */
864
+ attachWebSocket(id: string, options?: AttachOptions): Promise<DockerWebSocket>;
865
+ /**
866
+ * Get an archive of a filesystem resource in a container
867
+ * @param id - Container ID or name
868
+ * @param path - Resource path in the container
869
+ * @returns Archive stream
870
+ */
871
+ getArchive(id: string, path: string): Promise<Response>;
872
+ /**
873
+ * Check if a file exists in a container
874
+ * @param id - Container ID or name
875
+ * @param path - Resource path in the container
876
+ * @returns Archive info or null
877
+ */
878
+ archiveInfo(id: string, path: string): Promise<ArchiveInfo | null>;
879
+ /**
880
+ * Extract an archive of files or folders to a directory in the container
881
+ * @param id - Container ID or name
882
+ * @param path - Path to extract to
883
+ * @param archive - Archive to extract
884
+ * @param noOverwriteDirNonDir - If true, will not overwrite a dir with a non-dir
885
+ * @param copyUIDGID - If set to true, copy ownership from archive to target
886
+ */
887
+ putArchive(id: string, path: string, archive: BodyInit, noOverwriteDirNonDir?: boolean, copyUIDGID?: boolean): Promise<void>;
888
+ /**
889
+ * Create an exec instance
890
+ * @param id - Container ID or name
891
+ * @param options - Exec create options
892
+ * @returns Exec create response with exec ID
893
+ */
894
+ execCreate(id: string, options: ExecCreateOptions): Promise<ExecCreateResponse>;
895
+ /**
896
+ * Start an exec instance
897
+ * @param id - Exec ID
898
+ * @param options - Exec start options
899
+ * @returns Exec stream
900
+ */
901
+ execStart(id: string, options?: ExecStartOptions): Promise<Response>;
902
+ /**
903
+ * Inspect an exec instance
904
+ * @param id - Exec ID
905
+ * @returns Exec inspect response
906
+ */
907
+ execInspect(id: string): Promise<ExecInspectResponse>;
908
+ /**
909
+ * Resize an exec TTY
910
+ * @param id - Exec ID
911
+ * @param h - Height of the TTY session
912
+ * @param w - Width of the TTY session
913
+ */
914
+ execResize(id: string, h: number, w: number): Promise<void>;
915
+ /**
916
+ * Delete stopped containers
917
+ * @param options - Prune options
918
+ * @returns Prune response with deleted containers and reclaimed space
919
+ */
920
+ prune(options?: PruneContainersOptions): Promise<ContainerPruneResponse>;
921
+ }
922
+ }
923
+ declare module "modules/distribution/types" {
924
+ export type ImageInformationResponse = {
925
+ Descriptor: {
926
+ mediaType: string;
927
+ digest: string;
928
+ size: number;
929
+ urls: string[] | null;
930
+ annotations: Record<string, string> | null;
931
+ data: string | null;
932
+ platform: {
933
+ architecture: string;
934
+ os: string;
935
+ "os.version"?: string;
936
+ "os.features"?: string[];
937
+ } | null;
938
+ artifactType: string | null;
939
+ };
940
+ Platforms: Array<{
941
+ architecture: string;
942
+ os: string;
943
+ "os.version"?: string;
944
+ "os.features"?: string[];
945
+ variant?: string;
946
+ }>;
947
+ };
948
+ }
949
+ declare module "modules/distribution/index" {
950
+ import { BaseModule } from "modules/base/index";
951
+ import type { ImageInformationResponse } from "modules/distribution/types";
952
+ export class DistributionModule extends BaseModule {
953
+ /**
954
+ * Return image digest and platform information by contacting the registry.
955
+ * @param image Image name or id
956
+ */
957
+ getImageInfo(image: string): Promise<ImageInformationResponse>;
958
+ }
959
+ }
960
+ declare module "modules/exec/types" {
961
+ /**
962
+ * Exec instance create options
963
+ */
964
+ export interface ExecCreateOptions {
965
+ AttachStdin?: boolean;
966
+ AttachStdout?: boolean;
967
+ AttachStderr?: boolean;
968
+ ConsoleSize?: [number, number] | null;
969
+ DetachKeys?: string;
970
+ Tty?: boolean;
971
+ Env?: string[];
972
+ Cmd?: string[];
973
+ Privileged?: boolean;
974
+ User?: string;
975
+ WorkingDir?: string;
976
+ }
977
+ /**
978
+ * Exec create response
979
+ */
980
+ export interface ExecCreateResponse {
981
+ Id: string;
982
+ }
983
+ /**
984
+ * Exec start options
985
+ */
986
+ export interface ExecStartOptions {
987
+ Detach?: boolean;
988
+ Tty?: boolean;
989
+ ConsoleSize?: [number, number] | null;
990
+ }
991
+ /**
992
+ * Exec inspect response
993
+ */
994
+ export interface ExecInspectResponse {
995
+ CanRemove: boolean;
996
+ DetachKeys: string;
997
+ ID: string;
998
+ Running: boolean;
999
+ ExitCode: number;
1000
+ ProcessConfig: ProcessConfig;
1001
+ OpenStdin: boolean;
1002
+ OpenStderr: boolean;
1003
+ OpenStdout: boolean;
1004
+ ContainerID: string;
1005
+ Pid: number;
1006
+ }
1007
+ /**
1008
+ * Process configuration
1009
+ */
1010
+ export interface ProcessConfig {
1011
+ arguments: string[];
1012
+ entrypoint: string;
1013
+ privileged: boolean;
1014
+ tty: boolean;
1015
+ user: string;
1016
+ }
1017
+ }
1018
+ declare module "modules/exec/index" {
1019
+ import { BaseModule } from "modules/base/index";
1020
+ import type { ExecCreateOptions, ExecCreateResponse, ExecInspectResponse, ExecStartOptions } from "modules/exec/types";
1021
+ /**
1022
+ * Exec Module - handles all Docker exec operations
1023
+ */
1024
+ export class ExecModule extends BaseModule {
1025
+ /**
1026
+ * Create an exec instance
1027
+ * @param containerId - Container ID or name
1028
+ * @param options - Exec configuration
1029
+ * @returns Exec create response with ID
1030
+ */
1031
+ create(containerId: string, options: ExecCreateOptions): Promise<ExecCreateResponse>;
1032
+ /**
1033
+ * Start an exec instance
1034
+ * @param execId - Exec instance ID
1035
+ * @param options - Start configuration
1036
+ * @returns Response object (for streaming)
1037
+ */
1038
+ start(execId: string, options?: ExecStartOptions): Promise<Response>;
1039
+ /**
1040
+ * Inspect an exec instance
1041
+ * @param execId - Exec instance ID
1042
+ * @returns Detailed exec instance information
1043
+ */
1044
+ inspect(execId: string): Promise<ExecInspectResponse>;
1045
+ /**
1046
+ * Resize an exec instance TTY session
1047
+ * @param execId - Exec instance ID
1048
+ * @param height - Height of TTY session in characters
1049
+ * @param width - Width of TTY session in characters
1050
+ */
1051
+ resize(execId: string, height: number, width: number): Promise<void>;
1052
+ }
1053
+ }
1054
+ declare module "modules/images/types" {
1055
+ import type { BodyInit } from "bun";
1056
+ /**
1057
+ * Image summary information returned by list
1058
+ */
1059
+ export interface ImageSummary {
1060
+ Id: string;
1061
+ ParentId: string;
1062
+ RepoTags: string[];
1063
+ RepoDigests: string[];
1064
+ Created: number;
1065
+ Size: number;
1066
+ SharedSize: number;
1067
+ Labels?: Record<string, string>;
1068
+ Containers: number;
1069
+ Manifests?: ImageManifestSummary[];
1070
+ Descriptor?: OCIDescriptor;
1071
+ }
1072
+ /**
1073
+ * Detailed image information returned by inspect
1074
+ */
1075
+ export interface ImageInspect {
1076
+ Id: string;
1077
+ Descriptor?: OCIDescriptor;
1078
+ Identity?: Identity;
1079
+ Manifests?: ImageManifestSummary[];
1080
+ RepoTags?: string[];
1081
+ RepoDigests?: string[];
1082
+ Comment?: string;
1083
+ Created?: string;
1084
+ Author?: string;
1085
+ Config?: ImageConfig;
1086
+ Architecture?: string;
1087
+ Variant?: string;
1088
+ Os?: string;
1089
+ OsVersion?: string;
1090
+ Size?: number;
1091
+ GraphDriver?: GraphDriver;
1092
+ RootFS?: RootFS;
1093
+ Metadata?: ImageMetadata;
1094
+ }
1095
+ /**
1096
+ * Image configuration
1097
+ */
1098
+ export interface ImageConfig {
1099
+ User?: string;
1100
+ ExposedPorts?: Record<string, object>;
1101
+ Env?: string[];
1102
+ Cmd?: string[];
1103
+ Healthcheck?: HealthConfig;
1104
+ ArgsEscaped?: boolean;
1105
+ Volumes?: Record<string, object>;
1106
+ WorkingDir?: string;
1107
+ Entrypoint?: string[];
1108
+ OnBuild?: string[];
1109
+ Labels?: Record<string, string>;
1110
+ StopSignal?: string;
1111
+ Shell?: string[];
1112
+ }
1113
+ /**
1114
+ * Root filesystem information
1115
+ */
1116
+ export interface RootFS {
1117
+ Type: string;
1118
+ Layers: string[];
1119
+ }
1120
+ /**
1121
+ * Image metadata
1122
+ */
1123
+ export interface ImageMetadata {
1124
+ LastTagTime?: string;
1125
+ }
1126
+ /**
1127
+ * Graph driver information
1128
+ */
1129
+ export interface GraphDriver {
1130
+ Name: string;
1131
+ Data: Record<string, string>;
1132
+ }
1133
+ /**
1134
+ * Image history item
1135
+ */
1136
+ export interface ImageHistoryResponseItem {
1137
+ Id: string;
1138
+ Created: number;
1139
+ CreatedBy: string;
1140
+ Tags: string[];
1141
+ Size: number;
1142
+ Comment: string;
1143
+ }
1144
+ /**
1145
+ * Image delete response item
1146
+ */
1147
+ export interface ImageDeleteResponseItem {
1148
+ Untagged?: string;
1149
+ Deleted?: string;
1150
+ }
1151
+ /**
1152
+ * Images disk usage
1153
+ */
1154
+ export interface ImagesDiskUsage {
1155
+ ActiveCount: number;
1156
+ TotalCount: number;
1157
+ Reclaimable: number;
1158
+ TotalSize: number;
1159
+ Items?: ImageSummary[];
1160
+ }
1161
+ /**
1162
+ * Image search result
1163
+ */
1164
+ export interface ImageSearchResponseItem {
1165
+ description: string;
1166
+ is_official: boolean;
1167
+ is_automated: boolean;
1168
+ name: string;
1169
+ star_count: number;
1170
+ }
1171
+ /**
1172
+ * Image prune response
1173
+ */
1174
+ export interface ImagePruneResponse {
1175
+ ImagesDeleted?: ImageDeleteResponseItem[];
1176
+ SpaceReclaimed: number;
1177
+ }
1178
+ /**
1179
+ * OCI descriptor
1180
+ */
1181
+ export interface OCIDescriptor {
1182
+ mediaType: string;
1183
+ digest: string;
1184
+ size: number;
1185
+ urls?: string[];
1186
+ annotations?: Record<string, string>;
1187
+ data?: string;
1188
+ platform?: OCIPlatform;
1189
+ artifactType?: string;
1190
+ }
1191
+ /**
1192
+ * OCI platform
1193
+ */
1194
+ export interface OCIPlatform {
1195
+ architecture: string;
1196
+ os: string;
1197
+ "os.version"?: string;
1198
+ "os.features"?: string[];
1199
+ variant?: string;
1200
+ }
1201
+ /**
1202
+ * Image manifest summary
1203
+ */
1204
+ export interface ImageManifestSummary {
1205
+ ID: string;
1206
+ Descriptor: OCIDescriptor;
1207
+ Available: boolean;
1208
+ Size: {
1209
+ Total: number;
1210
+ Content: number;
1211
+ };
1212
+ Kind: "manifest" | "index" | "unknown";
1213
+ ImageData?: {
1214
+ Platform: OCIPlatform;
1215
+ Identity?: Identity;
1216
+ Containers?: string[];
1217
+ Size?: {
1218
+ Unpacked: number;
1219
+ };
1220
+ };
1221
+ AttestationData?: {
1222
+ For: string;
1223
+ };
1224
+ }
1225
+ /**
1226
+ * Identity information
1227
+ */
1228
+ export interface Identity {
1229
+ Signature?: SignatureIdentity[];
1230
+ Pull?: PullIdentity[];
1231
+ Build?: BuildIdentity[];
1232
+ }
1233
+ /**
1234
+ * Build identity
1235
+ */
1236
+ export interface BuildIdentity {
1237
+ Ref: string;
1238
+ CreatedAt: string;
1239
+ }
1240
+ /**
1241
+ * Pull identity
1242
+ */
1243
+ export interface PullIdentity {
1244
+ Repository: string;
1245
+ }
1246
+ /**
1247
+ * Signature identity
1248
+ */
1249
+ export interface SignatureIdentity {
1250
+ Name: string;
1251
+ Timestamps: SignatureTimestamp[];
1252
+ KnownSigner?: KnownSignerIdentity;
1253
+ DockerReference?: string;
1254
+ Signer?: SignerIdentity;
1255
+ SignatureType?: SignatureType;
1256
+ Error?: string;
1257
+ Warnings?: string[];
1258
+ }
1259
+ /**
1260
+ * Signature timestamp
1261
+ */
1262
+ export interface SignatureTimestamp {
1263
+ Type: SignatureTimestampType;
1264
+ URI?: string;
1265
+ Timestamp: string;
1266
+ }
1267
+ /**
1268
+ * Signature timestamp type
1269
+ */
1270
+ export type SignatureTimestampType = "sig" | "exp" | "att";
1271
+ /**
1272
+ * Signature type
1273
+ */
1274
+ export type SignatureType = "cosign" | "notation" | "sbom";
1275
+ /**
1276
+ * Known signer identity
1277
+ */
1278
+ export type KnownSignerIdentity = "docker-official" | "docker-notary-service";
1279
+ /**
1280
+ * Signer identity
1281
+ */
1282
+ export interface SignerIdentity {
1283
+ CertificateIssuer?: string;
1284
+ SubjectAlternativeName?: string;
1285
+ Issuer?: string;
1286
+ BuildSignerURI?: string;
1287
+ BuildSignerDigest?: string;
1288
+ RunnerEnvironment?: string;
1289
+ SourceRepositoryURI?: string;
1290
+ SourceRepositoryDigest?: string;
1291
+ SourceRepositoryRef?: string;
1292
+ SourceRepositoryIdentifier?: string;
1293
+ SourceRepositoryOwnerURI?: string;
1294
+ SourceRepositoryOwnerIdentifier?: string;
1295
+ BuildConfigURI?: string;
1296
+ BuildConfigDigest?: string;
1297
+ BuildTrigger?: string;
1298
+ RunInvocationURI?: string;
1299
+ SourceRepositoryVisibilityAtSigning?: string;
1300
+ }
1301
+ /**
1302
+ * Image ID
1303
+ */
1304
+ export interface ImageID {
1305
+ Id: string;
1306
+ }
1307
+ /**
1308
+ * Create image information
1309
+ */
1310
+ export interface CreateImageInfo {
1311
+ id?: string;
1312
+ errorDetail?: ErrorDetail;
1313
+ status?: string;
1314
+ progressDetail?: ProgressDetail;
1315
+ }
1316
+ /**
1317
+ * Push image information
1318
+ */
1319
+ export interface PushImageInfo {
1320
+ errorDetail?: ErrorDetail;
1321
+ status?: string;
1322
+ progressDetail?: ProgressDetail;
1323
+ }
1324
+ /**
1325
+ * Error detail
1326
+ */
1327
+ export interface ErrorDetail {
1328
+ code?: number;
1329
+ message: string;
1330
+ }
1331
+ /**
1332
+ * Progress detail
1333
+ */
1334
+ export interface ProgressDetail {
1335
+ current?: number;
1336
+ total?: number;
1337
+ }
1338
+ /**
1339
+ * Health configuration
1340
+ */
1341
+ export interface HealthConfig {
1342
+ Test?: string[];
1343
+ Interval?: number;
1344
+ Timeout?: number;
1345
+ Retries?: number;
1346
+ StartPeriod?: number;
1347
+ StartInterval?: number;
1348
+ }
1349
+ /**
1350
+ * Build cache disk usage
1351
+ */
1352
+ export interface BuildCacheDiskUsage {
1353
+ ActiveCount: number;
1354
+ TotalCount: number;
1355
+ Reclaimable: number;
1356
+ TotalSize: number;
1357
+ Items?: BuildCache[];
1358
+ }
1359
+ /**
1360
+ * Build cache
1361
+ */
1362
+ export interface BuildCache {
1363
+ ID: string;
1364
+ Parents?: string[];
1365
+ Type: string;
1366
+ Description?: string;
1367
+ InUse?: boolean;
1368
+ Shared?: boolean;
1369
+ Size?: number;
1370
+ CreatedAt: string;
1371
+ LastUsedAt?: string;
1372
+ UsageCount?: number;
1373
+ }
1374
+ /**
1375
+ * List images options
1376
+ */
1377
+ export interface ListImagesOptions {
1378
+ all?: boolean;
1379
+ filters?: {
1380
+ before?: string[];
1381
+ dangling?: string[];
1382
+ label?: string[];
1383
+ reference?: string[];
1384
+ since?: string[];
1385
+ until?: string[];
1386
+ };
1387
+ sharedSize?: boolean;
1388
+ digests?: boolean;
1389
+ manifests?: boolean;
1390
+ identity?: boolean;
1391
+ }
1392
+ /**
1393
+ * Pull image options
1394
+ */
1395
+ export interface PullImageOptions {
1396
+ fromImage: string;
1397
+ tag?: string;
1398
+ platform?: string;
1399
+ fromSrc?: string;
1400
+ repo?: string;
1401
+ message?: string;
1402
+ inputImage?: BodyInit;
1403
+ changes?: string[];
1404
+ authHeader?: string;
1405
+ }
1406
+ /**
1407
+ * Push image options
1408
+ */
1409
+ export interface PushImageOptions {
1410
+ tag?: string;
1411
+ platform?: string;
1412
+ authHeader: string;
1413
+ }
1414
+ /**
1415
+ * Tag image options
1416
+ */
1417
+ export interface TagImageOptions {
1418
+ repo: string;
1419
+ tag?: string;
1420
+ }
1421
+ /**
1422
+ * Remove image options
1423
+ */
1424
+ export interface RemoveImageOptions {
1425
+ force?: boolean;
1426
+ noprune?: boolean;
1427
+ platforms?: string[];
1428
+ }
1429
+ /**
1430
+ * Search images options
1431
+ */
1432
+ export interface SearchImagesOptions {
1433
+ term: string;
1434
+ limit?: number;
1435
+ filters?: {
1436
+ "is-official"?: string[];
1437
+ stars?: string[];
1438
+ };
1439
+ }
1440
+ /**
1441
+ * Prune images options
1442
+ */
1443
+ export interface PruneImagesOptions {
1444
+ filters?: {
1445
+ dangling?: string[];
1446
+ until?: string[];
1447
+ label?: string[];
1448
+ };
1449
+ }
1450
+ /**
1451
+ * Inspect image options
1452
+ */
1453
+ export interface InspectImageOptions {
1454
+ manifests?: boolean;
1455
+ platform?: string;
1456
+ }
1457
+ /**
1458
+ * History image options
1459
+ */
1460
+ export interface HistoryImageOptions {
1461
+ platform?: string;
1462
+ }
1463
+ /**
1464
+ * Export image options
1465
+ */
1466
+ export interface ExportImageOptions {
1467
+ name: string;
1468
+ platform?: string[];
1469
+ }
1470
+ /**
1471
+ * Export all images options
1472
+ */
1473
+ export interface ExportAllImagesOptions {
1474
+ names?: string[];
1475
+ platform?: string[];
1476
+ }
1477
+ /**
1478
+ * Load image options
1479
+ */
1480
+ export interface LoadImageOptions {
1481
+ imagesTarball: BodyInit;
1482
+ quiet?: boolean;
1483
+ platform?: string[];
1484
+ }
1485
+ /**
1486
+ * Build image options
1487
+ */
1488
+ export interface BuildImageOptions {
1489
+ inputStream?: BodyInit;
1490
+ dockerfile?: string;
1491
+ t?: string;
1492
+ extrahosts?: string;
1493
+ remote?: string;
1494
+ q?: boolean;
1495
+ nocache?: boolean;
1496
+ cachefrom?: string;
1497
+ pull?: string;
1498
+ rm?: boolean;
1499
+ forcerm?: boolean;
1500
+ memory?: number;
1501
+ memswap?: number;
1502
+ cpushares?: number;
1503
+ cpusetcpus?: string;
1504
+ cpuperiod?: number;
1505
+ cpuquota?: number;
1506
+ buildargs?: string;
1507
+ shmsize?: number;
1508
+ squash?: boolean;
1509
+ labels?: string;
1510
+ networkmode?: string;
1511
+ authConfig?: string;
1512
+ platform?: string;
1513
+ target?: string;
1514
+ outputs?: string;
1515
+ version?: "1" | "2";
1516
+ }
1517
+ /**
1518
+ * Prune build cache options
1519
+ */
1520
+ export interface PruneBuildCacheOptions {
1521
+ all?: boolean;
1522
+ "keep-storage"?: number;
1523
+ filters?: {
1524
+ until?: string;
1525
+ id?: string[];
1526
+ };
1527
+ }
1528
+ /**
1529
+ *
1530
+ */
1531
+ export interface CommitParams {
1532
+ container: string;
1533
+ repo: string;
1534
+ tag: string;
1535
+ comment: string;
1536
+ author: string;
1537
+ pause: boolean;
1538
+ changes: string;
1539
+ }
1540
+ export interface CommitBody {
1541
+ /** The hostname to use for the container, as a valid RFC 1123 hostname. */
1542
+ Hostname: string;
1543
+ /** The domain name to use for the container. */
1544
+ Domainname: string;
1545
+ /**
1546
+ * Commands run as this user inside the container.
1547
+ * If omitted, commands run as the user
1548
+ * specified in the image the container was started from.
1549
+ *
1550
+ * Can be either user-name or UID, and optional group-name or GID,
1551
+ * separated by a colon (`<user-name|UID>[<:group-name|GID>]`).
1552
+ */
1553
+ User: string;
1554
+ /**
1555
+ * Whether to attach to stdin.
1556
+ * Default: false
1557
+ */
1558
+ AttachStdin: boolean;
1559
+ /**
1560
+ * Whether to attach to stdout.
1561
+ * Default: true
1562
+ */
1563
+ AttachStdout: boolean;
1564
+ /**
1565
+ * Whether to attach to stderr.
1566
+ * Default: true
1567
+ */
1568
+ AttachStderr: boolean;
1569
+ /**
1570
+ * An object mapping ports to an empty object in the form: {"<port>/<tcp|udp|sctp>": {}}
1571
+ */
1572
+ ExposedPorts: null | Record<string, unknown>;
1573
+ /**
1574
+ * Attach standard streams to a TTY, including stdin if it is not closed.
1575
+ * Default: false
1576
+ */
1577
+ Tty: boolean;
1578
+ /** Default: false */
1579
+ OpenStdin: boolean;
1580
+ /**
1581
+ * Close stdin after one attached client disconnects
1582
+ * Default: false
1583
+ */
1584
+ StdinOnce: boolean;
1585
+ /**
1586
+ * A list of environment variables to set inside the container
1587
+ * in the form ["VAR=value", ...].
1588
+ * A variable without = is removed from the environment,
1589
+ * rather than to have an empty value.
1590
+ */
1591
+ Env: string[];
1592
+ /** Command to run specified as a string or an array of strings. */
1593
+ Cmd: string | string[];
1594
+ /**
1595
+ * A test to perform to check that the container is healthy.
1596
+ * Healthcheck commands should be side-effect free.
1597
+ */
1598
+ HealthCheck: {
1599
+ /**
1600
+ * The test to perform. Possible values are:
1601
+ * - [] inherit healthcheck from image or parent image
1602
+ * - ["NONE"] disable healthcheck
1603
+ * - ["CMD", args...] exec arguments directly
1604
+ * - ["CMD-SHELL", command] run command with system's default shell
1605
+ * A non-zero exit code indicates a failed healthcheck:
1606
+ * - 0 healthy
1607
+ * - 1 unhealthy
1608
+ * - 2 reserved (treated as unhealthy)
1609
+ * - other values: error running probe
1610
+ */
1611
+ Test: string[];
1612
+ /**
1613
+ * The time to wait between checks in nanoseconds.
1614
+ * It should be 0 or at least 1000000 (1 ms). 0 means inherit.
1615
+ */
1616
+ Interval: number;
1617
+ /**
1618
+ * The time to wait before considering the check to have hung.
1619
+ * It should be 0 or at least 1000000 (1 ms). 0 means inherit.
1620
+ */
1621
+ Timeout: number;
1622
+ /**
1623
+ * The number of consecutive failures needed to consider a container as unhealthy.
1624
+ * 0 means inherit.
1625
+ */
1626
+ Retries: number;
1627
+ /** Start period for the container to initialize before starting health-retries
1628
+ * countdown in nanoseconds.
1629
+ * It should be 0 or at least 1000000 (1 ms).
1630
+ * 0 means inherit.
1631
+ * */
1632
+ StartPeriod: number;
1633
+ /**
1634
+ * The time to wait between checks in nanoseconds during the start period.
1635
+ * It should be 0 or at least 1000000 (1 ms).
1636
+ * 0 means inherit.
1637
+ */
1638
+ StartInterval: number;
1639
+ };
1640
+ /**
1641
+ * Command is already escaped (Windows only)
1642
+ * Default: false
1643
+ * */
1644
+ ArgsEscaped: boolean | null;
1645
+ /**
1646
+ * The name (or reference) of the image to use when creating the container,
1647
+ * or which was used when the container was created.
1648
+ */
1649
+ Image: string;
1650
+ /**
1651
+ * An object mapping mount point paths inside the container to empty objects.
1652
+ */
1653
+ Volumes: Record<string, unknown>;
1654
+ /**
1655
+ * The working directory for commands to run in.
1656
+ */
1657
+ WorkingDir: string;
1658
+ /**
1659
+ * The entry point for the container as a string or an array of strings.
1660
+ * If the array consists of exactly one empty string ([""]),
1661
+ * then the entry point is reset to system default
1662
+ * (i.e., the entry point used by docker when there is no ENTRYPOINT instruction in the Dockerfile).
1663
+ */
1664
+ Entrypoint: string[];
1665
+ /**
1666
+ * Disable networking for the container.
1667
+ */
1668
+ NetworkDisabled: boolean | null;
1669
+ /**
1670
+ * `ONBUILD` metadata that were defined in the image's Dockerfile.
1671
+ */
1672
+ OnBuild: string[] | null;
1673
+ /**
1674
+ * User-defined key/value metadata.
1675
+ */
1676
+ Labels: Record<string, string>;
1677
+ /**
1678
+ * Signal to stop a container as a string or unsigned integer.
1679
+ */
1680
+ StopSignal: string | number | null;
1681
+ /**
1682
+ * Timeout to stop a container in seconds.
1683
+ * Default: 10
1684
+ */
1685
+ StopTimeout: number;
1686
+ /**
1687
+ * Shell for when RUN, CMD, and ENTRYPOINT uses a shell.
1688
+ */
1689
+ Shell: string[];
1690
+ }
1691
+ }
1692
+ declare module "modules/images/index" {
1693
+ import { BaseModule } from "modules/base/index";
1694
+ import type { BuildCacheDiskUsage, BuildImageOptions, CommitBody, CommitParams, CreateImageInfo, ExportAllImagesOptions, ExportImageOptions, HistoryImageOptions, ImageDeleteResponseItem, ImageHistoryResponseItem, ImageID, ImageInspect, ImagePruneResponse, ImageSearchResponseItem, ImageSummary, InspectImageOptions, ListImagesOptions, LoadImageOptions, PruneBuildCacheOptions, PruneImagesOptions, PullImageOptions, PushImageInfo, PushImageOptions, RemoveImageOptions, SearchImagesOptions, TagImageOptions } from "modules/images/types";
1695
+ /**
1696
+ * Images Module - handles all Docker image operations
1697
+ */
1698
+ export class ImagesModule extends BaseModule {
1699
+ /**
1700
+ * List images
1701
+ * @param options - List options
1702
+ * @returns Array of image summaries
1703
+ */
1704
+ list(options?: ListImagesOptions): Promise<ImageSummary[]>;
1705
+ /**
1706
+ * Create (pull) an image
1707
+ * @param options - Pull options
1708
+ * @returns Image creation info
1709
+ */
1710
+ pull(options: PullImageOptions): Promise<CreateImageInfo[]>;
1711
+ /**
1712
+ * Inspect an image
1713
+ * @param name - Image name or ID
1714
+ * @param options - Inspect options
1715
+ * @returns Detailed image information
1716
+ */
1717
+ inspect(name: string, options?: InspectImageOptions): Promise<ImageInspect>;
1718
+ /**
1719
+ * Get image history
1720
+ * @param name - Image name or ID
1721
+ * @param options - History options
1722
+ * @returns Array of image history items
1723
+ */
1724
+ history(name: string, options?: HistoryImageOptions): Promise<ImageHistoryResponseItem[]>;
1725
+ /**
1726
+ * Push an image
1727
+ * @param name - Image name to push
1728
+ * @param options - Push options
1729
+ * @returns Push info
1730
+ */
1731
+ push(name: string, options: PushImageOptions): Promise<PushImageInfo[]>;
1732
+ /**
1733
+ * Tag an image
1734
+ * @param name - Image name or ID to tag
1735
+ * @param options - Tag options
1736
+ */
1737
+ tag(name: string, options: TagImageOptions): Promise<void>;
1738
+ /**
1739
+ * Remove an image
1740
+ * @param name - Image name or ID
1741
+ * @param options - Remove options
1742
+ * @returns Array of delete response items
1743
+ */
1744
+ remove(name: string, options?: RemoveImageOptions): Promise<ImageDeleteResponseItem[]>;
1745
+ /**
1746
+ * Search images
1747
+ * @param options - Search options
1748
+ * @returns Array of search results
1749
+ */
1750
+ search(options: SearchImagesOptions): Promise<ImageSearchResponseItem[]>;
1751
+ /**
1752
+ * Prune unused images
1753
+ * @param options - Prune options
1754
+ * @returns Prune response
1755
+ */
1756
+ prune(options?: PruneImagesOptions): Promise<ImagePruneResponse>;
1757
+ /**
1758
+ * Export an image
1759
+ * @param name - Image name or ID
1760
+ * @param options - Export options
1761
+ * @returns Response with tarball
1762
+ */
1763
+ get(name: string, options?: ExportImageOptions): Promise<Response>;
1764
+ /**
1765
+ * Export multiple images
1766
+ * @param options - Export options
1767
+ * @returns Response with tarball
1768
+ */
1769
+ getAll(options?: ExportAllImagesOptions): Promise<Response>;
1770
+ /**
1771
+ * Load images
1772
+ * @param options - Load options
1773
+ * @returns Load response
1774
+ */
1775
+ load(options: LoadImageOptions): Promise<unknown>;
1776
+ /**
1777
+ * Build an image from a tar archive with a Dockerfile in it.
1778
+ * The Dockerfile specifies how the image is built from the tar archive.
1779
+ * It is typically in the archive's root,
1780
+ * but can be at a different path or have a different name by specifying the dockerfile parameter.
1781
+ * See the Dockerfile reference for more information.
1782
+ *
1783
+ * The Docker daemon performs a preliminary validation of the Dockerfile before starting the build,
1784
+ * and returns an error if the syntax is incorrect.
1785
+ * After that, each instruction is run one-by-one until the ID of the new image is output.
1786
+ *
1787
+ * The build is canceled if the client drops the connection by quitting or being killed.
1788
+ * @param options - Build options
1789
+ * @returns Build info
1790
+ */
1791
+ build(options: BuildImageOptions): Promise<boolean>;
1792
+ /**
1793
+ * Prune build cache
1794
+ * @param options - Prune build cache options
1795
+ * @returns Build cache disk usage
1796
+ */
1797
+ pruneBuild(options?: PruneBuildCacheOptions): Promise<BuildCacheDiskUsage>;
1798
+ /**
1799
+ * Commit a container as an image
1800
+ * @param container - Container ID or name
1801
+ * @param options - Commit options
1802
+ * @returns Image ID
1803
+ */
1804
+ commit(containerConfig: CommitBody, options: CommitParams): Promise<ImageID>;
1805
+ }
1806
+ }
1807
+ declare module "modules/networks/types" {
1808
+ /**
1809
+ * Network configuration and state
1810
+ */
1811
+ export interface Network {
1812
+ Name?: string;
1813
+ Id?: string;
1814
+ Created?: number;
1815
+ Scope?: string;
1816
+ Driver?: string;
1817
+ EnableIPv4?: boolean;
1818
+ EnableIPv6?: boolean;
1819
+ IPAM?: IPAM;
1820
+ Internal?: boolean;
1821
+ Attachable?: boolean;
1822
+ Ingress?: boolean;
1823
+ ConfigFrom?: ConfigReference;
1824
+ ConfigOnly?: boolean;
1825
+ Options?: Record<string, string>;
1826
+ Labels?: Record<string, string>;
1827
+ Peers?: PeerInfo[];
1828
+ }
1829
+ /**
1830
+ * Network summary (extends Network)
1831
+ */
1832
+ export interface NetworkSummary extends Network {
1833
+ }
1834
+ /**
1835
+ * Full network inspection details
1836
+ */
1837
+ export interface NetworkInspect extends Network {
1838
+ Containers?: Record<string, EndpointResource>;
1839
+ Services?: Record<string, ServiceInfo>;
1840
+ Status?: NetworkStatus;
1841
+ }
1842
+ /**
1843
+ * Network status information
1844
+ */
1845
+ export interface NetworkStatus {
1846
+ IPAM?: IPAMStatus;
1847
+ }
1848
+ /**
1849
+ * Service information in a network
1850
+ */
1851
+ export interface ServiceInfo {
1852
+ VIP?: string;
1853
+ Ports?: string[];
1854
+ LocalLBIndex?: number;
1855
+ Tasks?: NetworkTaskInfo[];
1856
+ }
1857
+ /**
1858
+ * Task information in a network
1859
+ */
1860
+ export interface NetworkTaskInfo {
1861
+ Name?: string;
1862
+ EndpointID?: string;
1863
+ EndpointIP?: string;
1864
+ MacAddress?: string;
1865
+ IPv4Address?: string;
1866
+ IPv6Address?: string;
1867
+ }
1868
+ /**
1869
+ * Config reference for network
1870
+ */
1871
+ export interface ConfigReference {
1872
+ Network?: string;
1873
+ }
1874
+ /**
1875
+ * IPAM configuration
1876
+ */
1877
+ export interface IPAM {
1878
+ Driver?: string;
1879
+ Config?: IPAMConfig[];
1880
+ Options?: Record<string, string>;
1881
+ }
1882
+ /**
1883
+ * IPAM configuration entry
1884
+ */
1885
+ export interface IPAMConfig {
1886
+ Subnet?: string;
1887
+ IPRange?: string;
1888
+ Gateway?: string;
1889
+ AuxiliaryAddresses?: Record<string, string>;
1890
+ }
1891
+ /**
1892
+ * IPAM status
1893
+ */
1894
+ export interface IPAMStatus {
1895
+ Subnets?: Record<string, SubnetStatus>;
1896
+ }
1897
+ /**
1898
+ * Subnet status
1899
+ */
1900
+ export interface SubnetStatus {
1901
+ IPsInUse?: number;
1902
+ DynamicIPsAvailable?: number;
1903
+ }
1904
+ /**
1905
+ * Endpoint resource information
1906
+ */
1907
+ export interface EndpointResource {
1908
+ Name?: string;
1909
+ EndpointID?: string;
1910
+ MacAddress?: string;
1911
+ IPv4Address?: string;
1912
+ IPv6Address?: string;
1913
+ }
1914
+ /**
1915
+ * Peer information
1916
+ */
1917
+ export interface PeerInfo {
1918
+ Name?: string;
1919
+ IP?: string;
1920
+ }
1921
+ /**
1922
+ * Network create response
1923
+ */
1924
+ export interface NetworkCreateResponse {
1925
+ Id?: string;
1926
+ Warning?: string;
1927
+ }
1928
+ /**
1929
+ * Network connect request
1930
+ */
1931
+ export interface NetworkConnectRequest {
1932
+ Container?: string;
1933
+ EndpointConfig?: EndpointSettings;
1934
+ }
1935
+ /**
1936
+ * Network disconnect request
1937
+ */
1938
+ export interface NetworkDisconnectRequest {
1939
+ Container?: string;
1940
+ Force?: boolean;
1941
+ }
1942
+ /**
1943
+ * Endpoint settings
1944
+ */
1945
+ export interface EndpointSettings {
1946
+ IPAMConfig?: EndpointIPAMConfig;
1947
+ Links?: string[];
1948
+ Aliases?: string[];
1949
+ NetworkID?: string;
1950
+ EndpointID?: string;
1951
+ Gateway?: string;
1952
+ IPAddress?: string;
1953
+ IPPrefixLen?: number;
1954
+ IPv6Gateway?: string;
1955
+ GlobalIPv6Address?: string;
1956
+ GlobalIPv6PrefixLen?: number;
1957
+ MacAddress?: string;
1958
+ DriverOpts?: Record<string, string>;
1959
+ }
1960
+ /**
1961
+ * Endpoint IPAM configuration
1962
+ */
1963
+ export interface EndpointIPAMConfig {
1964
+ IPv4Address?: string;
1965
+ IPv6Address?: string;
1966
+ LinkLocalIPs?: string[];
1967
+ }
1968
+ /**
1969
+ * Network prune response
1970
+ */
1971
+ export interface NetworkPruneResponse {
1972
+ NetworksDeleted?: string[];
1973
+ }
1974
+ /**
1975
+ * List networks options
1976
+ */
1977
+ export interface ListNetworksOptions {
1978
+ filters?: {
1979
+ dangling?: boolean[];
1980
+ driver?: string[];
1981
+ id?: string[];
1982
+ label?: string[];
1983
+ name?: string[];
1984
+ scope?: string[];
1985
+ type?: string[];
1986
+ };
1987
+ }
1988
+ /**
1989
+ * Create network options
1990
+ */
1991
+ export interface CreateNetworkOptions {
1992
+ Name: string;
1993
+ CheckDuplicate?: boolean;
1994
+ Driver?: string;
1995
+ Internal?: boolean;
1996
+ Attachable?: boolean;
1997
+ Ingress?: boolean;
1998
+ IPAM?: IPAM;
1999
+ EnableIPv6?: boolean;
2000
+ Options?: Record<string, string>;
2001
+ Labels?: Record<string, string>;
2002
+ Scope?: string;
2003
+ }
2004
+ /**
2005
+ * Inspect network options
2006
+ */
2007
+ export interface InspectNetworkOptions {
2008
+ verbose?: boolean;
2009
+ scope?: string;
2010
+ }
2011
+ /**
2012
+ * Connect network options
2013
+ */
2014
+ export interface ConnectNetworkOptions {
2015
+ Container?: string;
2016
+ EndpointConfig?: EndpointSettings;
2017
+ }
2018
+ /**
2019
+ * Disconnect network options
2020
+ */
2021
+ export interface DisconnectNetworkOptions {
2022
+ Container?: string;
2023
+ Force?: boolean;
2024
+ }
2025
+ /**
2026
+ * Prune networks options
2027
+ */
2028
+ export interface PruneNetworksOptions {
2029
+ filters?: {
2030
+ dangling?: boolean[];
2031
+ label?: string[];
2032
+ until?: string[];
2033
+ };
2034
+ }
2035
+ }
2036
+ declare module "modules/networks/index" {
2037
+ import { BaseModule } from "modules/base/index";
2038
+ import type { CreateNetworkOptions, ListNetworksOptions, NetworkConnectRequest, NetworkCreateResponse, NetworkDisconnectRequest, NetworkInspect, NetworkPruneResponse, NetworkSummary, PruneNetworksOptions } from "modules/networks/types";
2039
+ /**
2040
+ * Networks module for managing Docker networks
2041
+ */
2042
+ export class NetworksModule extends BaseModule {
2043
+ /**
2044
+ * List networks
2045
+ * @param options - List options including filters
2046
+ * @returns Array of network summaries
2047
+ */
2048
+ list(options?: ListNetworksOptions): Promise<NetworkSummary[]>;
2049
+ /**
2050
+ * Create a network
2051
+ * @param config - Network configuration
2052
+ * @returns Network create response with ID and warnings
2053
+ */
2054
+ create(config: CreateNetworkOptions): Promise<NetworkCreateResponse>;
2055
+ /**
2056
+ * Inspect a network
2057
+ * @param id - Network ID or name
2058
+ * @param options - Inspect options
2059
+ * @returns Detailed network information
2060
+ */
2061
+ inspect(id: string, options?: {
2062
+ verbose?: boolean;
2063
+ scope?: string;
2064
+ }): Promise<NetworkInspect>;
2065
+ /**
2066
+ * Remove a network
2067
+ * @param id - Network ID or name
2068
+ */
2069
+ remove(id: string): Promise<void>;
2070
+ /**
2071
+ * Connect a container to a network
2072
+ * @param id - Network ID or name
2073
+ * @param request - Connection request with container and endpoint config
2074
+ */
2075
+ connect(id: string, request: NetworkConnectRequest): Promise<void>;
2076
+ /**
2077
+ * Disconnect a container from a network
2078
+ * @param id - Network ID or name
2079
+ * @param request - Disconnection request with container and force option
2080
+ */
2081
+ disconnect(id: string, request: NetworkDisconnectRequest): Promise<void>;
2082
+ /**
2083
+ * Remove unused networks
2084
+ * @param options - Prune options including filters
2085
+ * @returns Prune response with deleted networks
2086
+ */
2087
+ prune(options?: PruneNetworksOptions): Promise<NetworkPruneResponse>;
2088
+ }
2089
+ }
2090
+ declare module "modules/nodes/types" {
2091
+ type NodeFilters = {
2092
+ id?: string[];
2093
+ label?: string[];
2094
+ membership?: Array<"accepted" | "pending">;
2095
+ name?: string[];
2096
+ "node.label"?: string[];
2097
+ role?: Array<"manager" | "worker">;
2098
+ };
2099
+ export type ListNodesOptions = {
2100
+ filters: NodeFilters;
2101
+ };
2102
+ export type NodeResponse = {
2103
+ ID: string;
2104
+ Version: {
2105
+ Index: number;
2106
+ };
2107
+ CreatedAt: string;
2108
+ UpdatedAt: string;
2109
+ Spec: {
2110
+ Name: string;
2111
+ Labels: Record<string, string>;
2112
+ Role: "worker" | "manager";
2113
+ Availability: "active" | "pause" | "drain";
2114
+ };
2115
+ Description: {
2116
+ Hostname: string;
2117
+ Platform: {
2118
+ Architecture: string;
2119
+ OS: string;
2120
+ };
2121
+ Resources: {
2122
+ NanoCPUs: number;
2123
+ MemoryBytes: number;
2124
+ GenericResources: Array<{
2125
+ DiscreteResourceSpec: {
2126
+ Kind: string;
2127
+ Value: number;
2128
+ };
2129
+ } | {
2130
+ NamedResourceSpec: {
2131
+ Kind: string;
2132
+ Value: string;
2133
+ };
2134
+ }>;
2135
+ };
2136
+ Engine: {
2137
+ EngineVersion: string;
2138
+ Labels: Record<string, string>;
2139
+ Plugins: Array<{
2140
+ Type: string;
2141
+ Name: string;
2142
+ }>;
2143
+ };
2144
+ TLSInfo: {
2145
+ TrustRoot: string;
2146
+ CertIssuerSubject: string;
2147
+ CertIssuerPublicKey: string;
2148
+ };
2149
+ };
2150
+ Status: {
2151
+ State: "unknown" | "down" | "ready" | "disconnected";
2152
+ Message: string;
2153
+ Addr: string;
2154
+ };
2155
+ ManagerStatus: {
2156
+ Leader: boolean;
2157
+ Reachability: "unknown" | "unreachable" | "reachable";
2158
+ Addr: string;
2159
+ } | null;
2160
+ };
2161
+ export type NodeUpdateOptions = {
2162
+ Name: string;
2163
+ Labels: Record<string, string>;
2164
+ Role: "worker" | "manager";
2165
+ Availability: "active" | "pause" | "drain";
2166
+ };
2167
+ }
2168
+ declare module "modules/nodes/index" {
2169
+ import { BaseModule } from "modules/base/index";
2170
+ import type { ListNodesOptions, NodeResponse, NodeUpdateOptions } from "modules/nodes/types";
2171
+ export class NodesModule extends BaseModule {
2172
+ /**
2173
+ * List nodes
2174
+ * @param options Filters to process on the nodes list, encoded as JSON (a Record<string, string[]>).
2175
+ * @returns NodeResponse[]
2176
+ */
2177
+ list(options?: ListNodesOptions): Promise<NodeResponse[]>;
2178
+ /**
2179
+ * Inspect a node
2180
+ * @param id The ID or name of the node
2181
+ */
2182
+ inspect(id: string): Promise<NodeResponse>;
2183
+ /**
2184
+ *
2185
+ * @param id The ID or name of the node
2186
+ * @param force Force remove a node from the swarm (Default: false)
2187
+ * @returns `true` or throws an DockerError
2188
+ */
2189
+ delete(id: string, force?: boolean): Promise<boolean>;
2190
+ /**
2191
+ *
2192
+ * @param id The ID or name of the node
2193
+ * @param version The version number of the node object being updated. This is required to avoid conflicting writes.
2194
+ * @param options What to update
2195
+ * @returns
2196
+ */
2197
+ update(id: string, version: number, options: NodeUpdateOptions): Promise<boolean>;
2198
+ }
2199
+ }
2200
+ declare module "modules/volumes/types" {
2201
+ /**
2202
+ * Volume information
2203
+ */
2204
+ export interface Volume {
2205
+ Name: string;
2206
+ Driver: string;
2207
+ Mountpoint: string;
2208
+ CreatedAt?: string;
2209
+ Status?: Record<string, string>;
2210
+ Labels: Record<string, string>;
2211
+ Scope: "local" | "global";
2212
+ ClusterVolume?: ClusterVolume;
2213
+ Options?: Record<string, string>;
2214
+ UsageData?: VolumeUsageData;
2215
+ }
2216
+ /**
2217
+ * Volume usage data
2218
+ */
2219
+ export interface VolumeUsageData {
2220
+ Size: number;
2221
+ RefCount: number;
2222
+ }
2223
+ /**
2224
+ * Volumes disk usage information
2225
+ */
2226
+ export interface VolumesDiskUsage {
2227
+ ActiveCount: number;
2228
+ TotalCount: number;
2229
+ Reclaimable: number;
2230
+ TotalSize: number;
2231
+ Items?: Volume[];
2232
+ }
2233
+ /**
2234
+ * Volume create request
2235
+ */
2236
+ export interface VolumeCreateRequest {
2237
+ Name?: string;
2238
+ Driver?: string;
2239
+ DriverOpts?: Record<string, string>;
2240
+ Labels?: Record<string, string>;
2241
+ ClusterVolumeSpec?: ClusterVolumeSpec;
2242
+ }
2243
+ /**
2244
+ * Volume list response
2245
+ */
2246
+ export interface VolumeListResponse {
2247
+ Volumes: Volume[];
2248
+ Warnings?: string[];
2249
+ }
2250
+ /**
2251
+ * Volume prune response
2252
+ */
2253
+ export interface VolumePruneResponse {
2254
+ VolumesDeleted?: string[];
2255
+ SpaceReclaimed: number;
2256
+ }
2257
+ /**
2258
+ * Cluster volume information (Swarm CSI cluster volumes)
2259
+ */
2260
+ export interface ClusterVolume {
2261
+ ID?: string;
2262
+ Version?: ObjectVersion;
2263
+ CreatedAt?: string;
2264
+ UpdatedAt?: string;
2265
+ Spec?: ClusterVolumeSpec;
2266
+ Info?: ClusterVolumeInfo;
2267
+ PublishStatus?: ClusterVolumePublishStatus[];
2268
+ }
2269
+ /**
2270
+ * Object version
2271
+ */
2272
+ export interface ObjectVersion {
2273
+ Index: number;
2274
+ }
2275
+ /**
2276
+ * Cluster volume spec
2277
+ */
2278
+ export interface ClusterVolumeSpec {
2279
+ Group?: string;
2280
+ AccessMode?: ClusterVolumeAccessMode;
2281
+ Secrets?: ClusterVolumeSecret[];
2282
+ AccessibilityRequirements?: ClusterVolumeAccessibilityRequirements;
2283
+ CapacityRange?: ClusterVolumeCapacityRange;
2284
+ Availability?: "active" | "pause" | "drain";
2285
+ }
2286
+ /**
2287
+ * Cluster volume access mode
2288
+ */
2289
+ export interface ClusterVolumeAccessMode {
2290
+ Scope: "single" | "multi";
2291
+ Sharing: "none" | "readonly" | "onewriter" | "all";
2292
+ MountVolume?: ClusterVolumeMountVolume;
2293
+ BlockVolume?: ClusterVolumeBlockVolume;
2294
+ }
2295
+ /**
2296
+ * Cluster volume mount volume options
2297
+ */
2298
+ export interface ClusterVolumeMountVolume {
2299
+ FsType?: string;
2300
+ MountFlags?: string[];
2301
+ }
2302
+ /**
2303
+ * Cluster volume block volume options
2304
+ */
2305
+ export interface ClusterVolumeBlockVolume {
2306
+ [key: string]: string;
2307
+ }
2308
+ /**
2309
+ * Cluster volume secret
2310
+ */
2311
+ export interface ClusterVolumeSecret {
2312
+ Key: string;
2313
+ Secret: string;
2314
+ }
2315
+ /**
2316
+ * Cluster volume accessibility requirements
2317
+ */
2318
+ export interface ClusterVolumeAccessibilityRequirements {
2319
+ Requisite?: Topology[];
2320
+ Preferred?: Topology[];
2321
+ }
2322
+ /**
2323
+ * Cluster volume capacity range
2324
+ */
2325
+ export interface ClusterVolumeCapacityRange {
2326
+ RequiredBytes?: number;
2327
+ LimitBytes?: number;
2328
+ }
2329
+ /**
2330
+ * Cluster volume info
2331
+ */
2332
+ export interface ClusterVolumeInfo {
2333
+ CapacityBytes?: number;
2334
+ VolumeContext?: Record<string, string>;
2335
+ VolumeID?: string;
2336
+ AccessibleTopology?: Topology[];
2337
+ }
2338
+ /**
2339
+ * Cluster volume publish status
2340
+ */
2341
+ export interface ClusterVolumePublishStatus {
2342
+ NodeID: string;
2343
+ State: "pending-publish" | "published" | "pending-node-unpublish" | "pending-controller-unpublish";
2344
+ PublishContext?: Record<string, string>;
2345
+ }
2346
+ /**
2347
+ * Topology information
2348
+ */
2349
+ export interface Topology {
2350
+ [key: string]: string;
2351
+ }
2352
+ /**
2353
+ * List volumes options
2354
+ */
2355
+ export interface ListVolumesOptions {
2356
+ filters?: {
2357
+ dangling?: boolean[];
2358
+ driver?: string[];
2359
+ label?: string[];
2360
+ name?: string[];
2361
+ };
2362
+ }
2363
+ /**
2364
+ * Prune volumes options
2365
+ */
2366
+ export interface PruneVolumesOptions {
2367
+ filters?: {
2368
+ label?: string[];
2369
+ all?: boolean[];
2370
+ };
2371
+ }
2372
+ /**
2373
+ * Volume update request (for cluster volumes)
2374
+ */
2375
+ export interface VolumeUpdateRequest {
2376
+ Spec: ClusterVolumeSpec;
2377
+ }
2378
+ }
2379
+ declare module "modules/volumes/index" {
2380
+ import { BaseModule } from "modules/base/index";
2381
+ import type { ListVolumesOptions, PruneVolumesOptions, Volume, VolumeCreateRequest, VolumeListResponse, VolumePruneResponse, VolumeUpdateRequest } from "modules/volumes/types";
2382
+ /**
2383
+ * Volume module for Docker API
2384
+ */
2385
+ export class VolumeModule extends BaseModule {
2386
+ /**
2387
+ * List volumes
2388
+ */
2389
+ list(options?: ListVolumesOptions): Promise<VolumeListResponse>;
2390
+ /**
2391
+ * Create a volume
2392
+ */
2393
+ create(config: VolumeCreateRequest): Promise<Volume>;
2394
+ /**
2395
+ * Inspect a volume
2396
+ */
2397
+ inspect(name: string): Promise<Volume>;
2398
+ /**
2399
+ * Update a volume (for cluster volumes only)
2400
+ */
2401
+ update(name: string, body: VolumeUpdateRequest, version: number): Promise<void>;
2402
+ /**
2403
+ * Remove a volume
2404
+ */
2405
+ remove(name: string, force?: boolean): Promise<void>;
2406
+ /**
2407
+ * Prune unused volumes
2408
+ */
2409
+ prune(options?: PruneVolumesOptions): Promise<VolumePruneResponse>;
2410
+ }
2411
+ }
2412
+ declare module "docker" {
2413
+ import type { ConnectionConfig } from "modules/base/types";
2414
+ import { ContainerModule } from "modules/container/index";
2415
+ import { DistributionModule } from "modules/distribution/index";
2416
+ import { ExecModule } from "modules/exec/index";
2417
+ import { ImagesModule } from "modules/images/index";
2418
+ import { NetworksModule } from "modules/networks/index";
2419
+ import { NodesModule } from "modules/nodes/index";
2420
+ import { VolumeModule } from "modules/volumes/index";
2421
+ export class Docker {
2422
+ private config;
2423
+ readonly containers: ContainerModule;
2424
+ readonly images: ImagesModule;
2425
+ readonly networks: NetworksModule;
2426
+ readonly volumes: VolumeModule;
2427
+ readonly exec: ExecModule;
2428
+ readonly distribution: DistributionModule;
2429
+ readonly nodes: NodesModule;
2430
+ constructor(config: ConnectionConfig);
2431
+ ping(): Promise<boolean>;
2432
+ }
2433
+ }
2434
+ declare module "utils/env" {
2435
+ import type { ConnectionConfig } from "modules/base/types";
2436
+ export const getConnectionConfig: () => ConnectionConfig;
2437
+ }
2438
+ declare module "index" {
2439
+ import { Docker } from "docker";
2440
+ export const createDockerFromEnv: () => Docker;
2441
+ export { Docker };
2442
+ }