UNPKG

69 kBTypeScriptView Raw
1/// <reference types="node" />
2
3import * as DockerModem from "docker-modem";
4import * as events from "events";
5import { ConnectConfig } from "ssh2";
6import * as stream from "stream";
7
8declare namespace Dockerode {
9 class Container {
10 constructor(modem: any, id: string);
11
12 modem: any;
13 id: string;
14
15 inspect(options: ContainerInspectOptions, callback: Callback<ContainerInspectInfo>): void;
16 inspect(callback: Callback<ContainerInspectInfo>): void;
17 inspect(options?: ContainerInspectOptions): Promise<ContainerInspectInfo>;
18
19 rename(options: {}, callback: Callback<any>): void;
20 rename(options: {}): Promise<any>;
21
22 update(options: {}, callback: Callback<any>): void;
23 update(options: {}): Promise<any>;
24
25 top(options: {}, callback: Callback<any>): void;
26 top(callback: Callback<any>): void;
27 top(options?: {}): Promise<any>;
28
29 changes(options: {}, callback: Callback<any>): void;
30 changes(callback: Callback<any>): void;
31 changes(options?: {}): Promise<any>;
32
33 export(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
34 export(callback: Callback<NodeJS.ReadableStream>): void;
35 export(options?: {}): Promise<NodeJS.ReadableStream>;
36
37 start(options: ContainerStartOptions, callback: Callback<any>): void;
38 start(callback: Callback<any>): void;
39 start(options?: ContainerStartOptions): Promise<any>;
40
41 pause(options: {}, callback: Callback<any>): void;
42 pause(callback: Callback<any>): void;
43 pause(options?: {}): Promise<any>;
44
45 unpause(options: {}, callback: Callback<any>): void;
46 unpause(callback: Callback<any>): void;
47 unpause(options?: {}): Promise<any>;
48
49 exec(options: ExecCreateOptions, callback: Callback<Exec>): void;
50 exec(options: ExecCreateOptions): Promise<Exec>;
51
52 commit(options: {}, callback: Callback<any>): void;
53 commit(callback: Callback<any>): void;
54 commit(options?: {}): Promise<any>;
55
56 stop(options: ContainerStopOptions, callback: Callback<any>): void;
57 stop(callback: Callback<any>): void;
58 stop(options?: ContainerStopOptions): Promise<any>;
59
60 restart(options: {}, callback: Callback<any>): void;
61 restart(callback: Callback<any>): void;
62 restart(options?: {}): Promise<any>;
63
64 kill(options: {}, callback: Callback<any>): void;
65 kill(callback: Callback<any>): void;
66 kill(options?: {}): Promise<any>;
67
68 resize(options: {}, callback: Callback<any>): void;
69 resize(callback: Callback<any>): void;
70 resize(options?: {}): Promise<any>;
71
72 wait(options: ContainerWaitOptions, callback: Callback<any>): void;
73 wait(callback: Callback<any>): void;
74 wait(options?: ContainerWaitOptions): Promise<any>;
75
76 remove(options: ContainerRemoveOptions, callback: Callback<any>): void;
77 remove(callback: Callback<any>): void;
78 remove(options?: {}): Promise<any>;
79
80 /** Deprecated since RAPI v1.20 */
81 copy(options: {}, callback: Callback<any>): void;
82 /** Deprecated since RAPI v1.20 */
83 copy(callback: Callback<any>): void;
84 /** Deprecated since RAPI v1.20 */
85 copy(options?: {}): Promise<any>;
86
87 getArchive(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
88 getArchive(options: {}): Promise<NodeJS.ReadableStream>;
89
90 infoArchive(options: {}, callback: Callback<any>): void;
91 infoArchive(options: {}): Promise<any>;
92
93 /** @param file Filename (will read synchronously), Buffer or stream */
94 putArchive(
95 file: string | Buffer | NodeJS.ReadableStream,
96 options: {},
97 callback: Callback<NodeJS.WritableStream>,
98 ): void;
99 putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise<NodeJS.ReadWriteStream>;
100
101 logs(options: ContainerLogsOptions & { follow?: false }, callback: Callback<Buffer>): void;
102 logs(options: ContainerLogsOptions & { follow: true }, callback: Callback<NodeJS.ReadableStream>): void;
103 logs(callback: Callback<Buffer>): void;
104 logs(options?: ContainerLogsOptions & { follow?: false }): Promise<Buffer>;
105 logs(options?: ContainerLogsOptions & { follow: true }): Promise<NodeJS.ReadableStream>;
106
107 stats(options: { stream?: false; "one-shot"?: boolean }, callback: Callback<ContainerStats>): void;
108 stats(options: { stream: true }, callback: Callback<NodeJS.ReadableStream>): void;
109 stats(callback: Callback<ContainerStats>): void;
110 stats(options?: { stream?: false; "one-shot"?: boolean }): Promise<ContainerStats>;
111 stats(options?: { stream: true }): Promise<NodeJS.ReadableStream>;
112
113 attach(options: ContainerAttachOptions, callback: Callback<NodeJS.ReadWriteStream>): void;
114 attach(options: ContainerAttachOptions): Promise<NodeJS.ReadWriteStream>;
115 }
116
117 class Image {
118 constructor(modem: any, name: string);
119
120 modem: any;
121 id: string;
122
123 inspect(callback: Callback<ImageInspectInfo>): void;
124 inspect(): Promise<ImageInspectInfo>;
125
126 history(callback: Callback<any>): void;
127 history(): Promise<any>;
128
129 get(callback: Callback<NodeJS.ReadableStream>): void;
130 get(): Promise<NodeJS.ReadableStream>;
131
132 push(options: ImagePushOptions, callback: Callback<NodeJS.ReadableStream>): void;
133 push(callback: Callback<NodeJS.ReadableStream>): void;
134 push(options?: ImagePushOptions): Promise<NodeJS.ReadableStream>;
135
136 tag(options: ImageTagOptions, callback: Callback<any>): void;
137 tag(callback: Callback<any>): void;
138 tag(options?: ImageTagOptions): Promise<any>;
139
140 remove(options: ImageRemoveOptions, callback: Callback<ImageRemoveInfo>): void;
141 remove(callback: Callback<ImageRemoveInfo>): void;
142 remove(options?: {}): Promise<any>;
143
144 distribution(options: ImageDistributionOptions, callback: Callback<ImageDistributionInfo>): void;
145 distribution(callback: Callback<ImageDistributionInfo>): void;
146 distribution(options?: ImageDistributionOptions): Promise<ImageDistributionInfo>;
147 }
148
149 class Volume {
150 constructor(modem: any, name: string);
151
152 modem: any;
153 name: string;
154
155 inspect(options: {}, callback: Callback<VolumeInspectInfo>): void;
156 inspect(callback: Callback<VolumeInspectInfo>): void;
157 inspect(options?: {}): Promise<VolumeInspectInfo>;
158
159 remove(options: VolumeRemoveOptions, callback: Callback<any>): void;
160 remove(callback: Callback<any>): void;
161 remove(options?: VolumeRemoveOptions): Promise<any>;
162 }
163
164 class Service {
165 constructor(modem: any, id: string);
166
167 modem: any;
168 id: string;
169
170 inspect(options: {}, callback: Callback<any>): void;
171 inspect(callback: Callback<any>): void;
172 inspect(options?: {}): Promise<any>;
173
174 remove(options: {}, callback: Callback<any>): void;
175 remove(callback: Callback<any>): void;
176 remove(options?: {}): Promise<any>;
177
178 update(options: {}, callback: Callback<any>): void;
179 update(options: {}): Promise<any>;
180
181 logs(options: ContainerLogsOptions, callback: Callback<NodeJS.ReadableStream>): void;
182 logs(callback: Callback<NodeJS.ReadableStream>): void;
183 logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
184 }
185
186 class Task {
187 constructor(modem: any, id: string);
188
189 modem: any;
190 id: string;
191
192 inspect(options: {}, callback: Callback<any>): void;
193 inspect(callback: Callback<any>): void;
194 inspect(options?: {}): Promise<any>;
195 }
196
197 class Node {
198 constructor(modem: any, id: string);
199
200 modem: any;
201 id: string;
202
203 inspect(options: {}, callback: Callback<any>): void;
204 inspect(callback: Callback<any>): void;
205 inspect(options?: {}): Promise<any>;
206
207 update(options: {}, callback: Callback<any>): void;
208 update(callback: Callback<any>): void;
209 update(options?: {}): Promise<any>;
210
211 remove(options: {}, callback: Callback<any>): void;
212 remove(callback: Callback<any>): void;
213 remove(options?: {}): Promise<any>;
214 }
215
216 class Plugin {
217 constructor(modem: any, name: string, remote?: any);
218
219 modem: any;
220 name: string;
221 remote: any;
222
223 inspect(options: {}, callback: Callback<PluginInspectInfo>): void;
224 inspect(callback: Callback<PluginInspectInfo>): void;
225 inspect(options?: {}): Promise<PluginInspectInfo>;
226
227 remove(options: {}, callback: Callback<any>): void;
228 remove(callback: Callback<any>): void;
229 remove(options?: {}): Promise<any>;
230
231 privileges(options: {}, callback: Callback<any>): void;
232 privileges(callback: Callback<any>): void;
233 privileges(options?: {}): Promise<any>;
234
235 pull(options: {}, callback: Callback<any>): void;
236 pull(options: {}): Promise<any>;
237
238 enable(options: {}, callback: Callback<any>): void;
239 enable(callback: Callback<any>): void;
240 enable(options?: {}): Promise<any>;
241
242 disable(options: {}, callback: Callback<any>): void;
243 disable(callback: Callback<any>): void;
244 disable(options?: {}): Promise<any>;
245
246 push(options: {}, callback: Callback<any>): void;
247 push(callback: Callback<any>): void;
248 push(options?: {}): Promise<any>;
249
250 configure(options: {}, callback: Callback<any>): void;
251 configure(callback: Callback<any>): void;
252 configure(options?: {}): Promise<any>;
253
254 upgrade(auth: any, options: {}, callback: Callback<any>): void;
255 upgrade(auth: any, callback: Callback<any>): void;
256 upgrade(auth: any, options?: {}): Promise<any>;
257 }
258
259 class Secret {
260 constructor(modem: any, id: string);
261
262 modem: any;
263 id: string;
264
265 inspect(options: {}, callback: Callback<Secret>): void;
266 inspect(callback: Callback<Secret>): void;
267 inspect(options?: {}): Promise<Secret>;
268
269 update(options: {}, callback: Callback<any>): void;
270 update(callback: Callback<any>): void;
271 update(options?: {}): Promise<any>;
272
273 remove(options: {}, callback: Callback<any>): void;
274 remove(callback: Callback<any>): void;
275 remove(options?: {}): Promise<any>;
276 }
277
278 class Network {
279 constructor(modem: any, id: string);
280
281 modem: any;
282 id: string;
283
284 inspect(callback: Callback<any>): void;
285 inspect(): Promise<any>;
286
287 remove(options: {}, callback: Callback<any>): void;
288 remove(callback: Callback<any>): void;
289 remove(options?: {}): Promise<any>;
290
291 connect(options: NetworkConnectOptions, callback: Callback<any>): void;
292 connect(callback: Callback<any>): void;
293 connect(options?: NetworkConnectOptions): Promise<any>;
294
295 disconnect(options: {}, callback: Callback<any>): void;
296 disconnect(callback: Callback<any>): void;
297 disconnect(options?: {}): Promise<any>;
298 }
299
300 class Exec {
301 constructor(modem: any, id: string);
302
303 modem: any;
304 id: string;
305
306 inspect(options: ExecInspectOptions, callback: Callback<ExecInspectInfo>): void;
307 inspect(callback: Callback<ExecInspectInfo>): void;
308 inspect(options?: ExecInspectOptions): Promise<ExecInspectInfo>;
309
310 start(options: ExecStartOptions, callback: Callback<stream.Duplex>): void;
311 start(options: ExecStartOptions): Promise<stream.Duplex>;
312
313 resize(options: {}, callback: Callback<any>): void;
314 resize(options: {}): Promise<any>;
315 }
316
317 class Config {
318 constructor(modem: any, id: string);
319
320 modem: any;
321 id: string;
322
323 inspect(options: {}, callback: Callback<ConfigInfo>): void;
324 inspect(callback: Callback<ConfigInfo>): void;
325 inspect(options?: {}): Promise<ConfigInfo>;
326
327 update(options: {}, callback: Callback<any>): void;
328 update(callback: Callback<any>): void;
329 update(options?: {}): Promise<any>;
330
331 remove(options: {}, callback: Callback<any>): void;
332 remove(callback: Callback<any>): void;
333 remove(options?: {}): Promise<any>;
334 }
335
336 type Duration = number;
337
338 interface ImageInfo {
339 Id: string;
340 ParentId: string;
341 RepoTags: string[] | undefined;
342 RepoDigests?: string[] | undefined;
343 Created: number;
344 Size: number;
345 VirtualSize: number;
346 SharedSize: number;
347 Labels: { [label: string]: string };
348 Containers: number;
349 }
350
351 interface ContainerInfo {
352 Id: string;
353 Names: string[];
354 Image: string;
355 ImageID: string;
356 Command: string;
357 Created: number;
358 Ports: Port[];
359 Labels: { [label: string]: string };
360 State: string;
361 Status: string;
362 HostConfig: {
363 NetworkMode: string;
364 };
365 NetworkSettings: {
366 Networks: { [networkType: string]: NetworkInfo };
367 };
368 Mounts: Array<{
369 Name?: string | undefined;
370 Type: string;
371 Source: string;
372 Destination: string;
373 Driver?: string | undefined;
374 Mode: string;
375 RW: boolean;
376 Propagation: string;
377 }>;
378 }
379
380 interface Port {
381 IP: string;
382 PrivatePort: number;
383 PublicPort: number;
384 Type: string;
385 }
386
387 interface NetworkInfo {
388 IPAMConfig?: any;
389 Links?: any;
390 Aliases?: any;
391 NetworkID: string;
392 EndpointID: string;
393 Gateway: string;
394 IPAddress: string;
395 IPPrefixLen: number;
396 IPv6Gateway: string;
397 GlobalIPv6Address: string;
398 GlobalIPv6PrefixLen: number;
399 MacAddress: string;
400 }
401
402 // Information returned from inspecting a network
403 interface NetworkInspectInfo {
404 Name: string;
405 Id: string;
406 Created: string;
407 Scope: string;
408 Driver: string;
409 EnableIPv6: boolean;
410 IPAM?: IPAM | undefined;
411 Internal: boolean;
412 Attachable: boolean;
413 Ingress: boolean;
414 ConfigFrom?: { Network: string } | undefined;
415 ConfigOnly: boolean;
416 Containers?: { [id: string]: NetworkContainer } | undefined;
417 Options?: { [key: string]: string } | undefined;
418 Labels?: { [key: string]: string } | undefined;
419 }
420
421 interface NetworkCreateOptions {
422 Name: string;
423 CheckDuplicate?: boolean | undefined;
424 Driver?: string | undefined;
425 Internal?: boolean | undefined;
426 Attachable?: boolean | undefined;
427 Ingress?: boolean | undefined;
428 IPAM?: IPAM | undefined;
429 EnableIPv6?: boolean | undefined;
430 Options?: { [option: string]: string } | undefined;
431 Labels?: { [label: string]: string } | undefined;
432
433 abortSignal?: AbortSignal;
434 }
435
436 interface NetworkConnectOptions {
437 Container?: string;
438 EndpointConfig?: EndpointSettings | undefined;
439 }
440
441 interface NetworkContainer {
442 Name: string;
443 EndpointID: string;
444 MacAddress: string;
445 IPv4Address: string;
446 IPv6Address: string;
447 }
448
449 /* tslint:disable:interface-name */
450 interface IPAM {
451 Driver: string;
452 Config?: Array<{ [key: string]: string }> | undefined;
453 Options?: { [key: string]: string } | undefined;
454 }
455 /* tslint:enable:interface-name */
456
457 interface VolumeCreateOptions {
458 Name?: string | undefined;
459 Driver?: string | undefined;
460 DriverOpts?: { [key: string]: string } | undefined;
461 Labels?: { [label: string]: string } | undefined;
462 abortSignal?: AbortSignal;
463 }
464
465 interface VolumePruneOptions {
466 abortSignal?: AbortSignal;
467 /**
468 * Filters to process on the prune list, encoded as JSON (a `map[string][]string`).
469 * A dictionary of key/value list is also accepted.
470 */
471 filters?: string | { [key: string]: string[] };
472 }
473
474 interface VolumeRemoveOptions {
475 abortSignal?: AbortSignal;
476 }
477
478 interface VolumeCreateResponse {
479 Name: string;
480 Driver: string;
481 Mountpoint: string;
482 CreatedAt?: string | undefined;
483 Status?: { [key: string]: string } | undefined;
484 Labels: { [label: string]: string };
485 Scope: string;
486 Options: { [key: string]: string };
487 // Field is sometimes present, and sometimes null
488 UsageData?:
489 | {
490 Size: number;
491 RefCount: number;
492 }
493 | null
494 | undefined;
495 }
496
497 interface VolumeInspectInfo {
498 Name: string;
499 Driver: string;
500 Mountpoint: string;
501 Status?: { [key: string]: string } | undefined;
502 Labels: { [key: string]: string };
503 Scope: "local" | "global";
504 // Field is always present, but sometimes is null
505 Options: { [key: string]: string } | null;
506 // Field is sometimes present, and sometimes null
507 UsageData?:
508 | {
509 Size: number;
510 RefCount: number;
511 }
512 | null
513 | undefined;
514 }
515
516 interface ContainerInspectInfo {
517 Id: string;
518 Created: string;
519 Path: string;
520 Args: string[];
521 State: {
522 Status: string;
523 Running: boolean;
524 Paused: boolean;
525 Restarting: boolean;
526 OOMKilled: boolean;
527 Dead: boolean;
528 Pid: number;
529 ExitCode: number;
530 Error: string;
531 StartedAt: string;
532 FinishedAt: string;
533 Health?:
534 | {
535 Status: string;
536 FailingStreak: number;
537 Log: Array<{
538 Start: string;
539 End: string;
540 ExitCode: number;
541 Output: string;
542 }>;
543 }
544 | undefined;
545 };
546 Image: string;
547 ResolvConfPath: string;
548 HostnamePath: string;
549 HostsPath: string;
550 LogPath: string;
551 Name: string;
552 RestartCount: number;
553 Driver: string;
554 Platform: string;
555 MountLabel: string;
556 ProcessLabel: string;
557 AppArmorProfile: string;
558 ExecIDs?: string[] | undefined;
559 HostConfig: HostConfig;
560 GraphDriver: {
561 Name: string;
562 Data: {
563 DeviceId: string;
564 DeviceName: string;
565 DeviceSize: string;
566 };
567 };
568 Mounts: Array<{
569 Name?: string | undefined;
570 Source: string;
571 Destination: string;
572 Mode: string;
573 RW: boolean;
574 Propagation: string;
575 }>;
576 Config: {
577 Hostname: string;
578 Domainname: string;
579 User: string;
580 AttachStdin: boolean;
581 AttachStdout: boolean;
582 AttachStderr: boolean;
583 ExposedPorts: { [portAndProtocol: string]: {} };
584 Tty: boolean;
585 OpenStdin: boolean;
586 StdinOnce: boolean;
587 Env: string[];
588 Cmd: string[];
589 Image: string;
590 Volumes: { [volume: string]: {} };
591 WorkingDir: string;
592 Entrypoint?: string | string[] | undefined;
593 OnBuild?: any;
594 Labels: { [label: string]: string };
595 };
596 NetworkSettings: {
597 Bridge: string;
598 SandboxID: string;
599 HairpinMode: boolean;
600 LinkLocalIPv6Address: string;
601 LinkLocalIPv6PrefixLen: number;
602 Ports: {
603 [portAndProtocol: string]: Array<{
604 HostIp: string;
605 HostPort: string;
606 }>;
607 };
608 SandboxKey: string;
609 SecondaryIPAddresses?: any;
610 SecondaryIPv6Addresses?: any;
611 EndpointID: string;
612 Gateway: string;
613 GlobalIPv6Address: string;
614 GlobalIPv6PrefixLen: number;
615 IPAddress: string;
616 IPPrefixLen: number;
617 IPv6Gateway: string;
618 MacAddress: string;
619 Networks: {
620 [type: string]: {
621 IPAMConfig?: any;
622 Links?: any;
623 Aliases?: any;
624 NetworkID: string;
625 EndpointID: string;
626 Gateway: string;
627 IPAddress: string;
628 IPPrefixLen: number;
629 IPv6Gateway: string;
630 GlobalIPv6Address: string;
631 GlobalIPv6PrefixLen: number;
632 MacAddress: string;
633 };
634 };
635 Node?:
636 | {
637 ID: string;
638 IP: string;
639 Addr: string;
640 Name: string;
641 Cpus: number;
642 Memory: number;
643 Labels: any;
644 }
645 | undefined;
646 };
647 }
648
649 interface NetworkListOptions {
650 /**
651 * JSON encoded value of the filters (a `map[string][]string`) to process on the networks list.
652 * A dictionary of key/value list is also accepted.
653 */
654 filters?: string | { [key: string]: string[] };
655 abortSignal?: AbortSignal;
656 }
657
658 interface NetworkStats {
659 [name: string]: {
660 rx_bytes: number;
661 rx_dropped: number;
662 rx_errors: number;
663 rx_packets: number;
664 tx_bytes: number;
665 tx_dropped: number;
666 tx_errors: number;
667 tx_packets: number;
668 endpoint_id?: string; // not used on linux
669 instance_id?: string; // not used on linux
670 };
671 }
672
673 interface VolumeListOptions {
674 abortSignal?: AbortSignal;
675 /**
676 * A JSON encoded value of the filters (a map[string][]string) to process on the volume list.
677 */
678 filters?: string | { [key: string]: string[] };
679 /**
680 * Show digest information as a RepoDigests field on each image.
681 * @default false
682 */
683 digests?: boolean;
684 }
685
686 interface NodeListOptions {
687 abortSignal?: AbortSignal;
688 /**
689 * Filters to process on the nodes list, encoded as JSON (a `map[string][]string`).
690 */
691 filters?: string;
692 }
693
694 interface CPUUsage {
695 percpu_usage: number[];
696 usage_in_usermode: number;
697 total_usage: number;
698 usage_in_kernelmode: number;
699 }
700
701 interface ThrottlingData {
702 periods: number;
703 throttled_periods: number;
704 throttled_time: number;
705 }
706
707 interface CPUStats {
708 cpu_usage: CPUUsage;
709 system_cpu_usage: number;
710 online_cpus: number;
711 throttling_data: ThrottlingData;
712 }
713
714 interface MemoryStats {
715 // Linux Memory Stats
716 stats: {
717 total_pgmajfault: number;
718 cache: number;
719 mapped_file: number;
720 total_inactive_file: number;
721 pgpgout: number;
722 rss: number;
723 total_mapped_file: number;
724 writeback: number;
725 unevictable: number;
726 pgpgin: number;
727 total_unevictable: number;
728 pgmajfault: number;
729 total_rss: number;
730 total_rss_huge: number;
731 total_writeback: number;
732 total_inactive_anon: number;
733 rss_huge: number;
734 hierarchical_memory_limit: number;
735 total_pgfault: number;
736 total_active_file: number;
737 active_anon: number;
738 total_active_anon: number;
739 total_pgpgout: number;
740 total_cache: number;
741 inactive_anon: number;
742 active_file: number;
743 pgfault: number;
744 inactive_file: number;
745 total_pgpgin: number;
746 };
747 max_usage: number;
748 usage: number;
749 failcnt: number;
750 limit: number;
751
752 // Windows Memory Stats
753 commitbytes?: number;
754 commitpeakbytes?: number;
755 privateworkingset?: number;
756 }
757
758 interface BlkioStatEntry {
759 major: number;
760 minor: number;
761 op: string;
762 value: number;
763 }
764
765 interface BlkioStats {
766 io_service_bytes_recursive: BlkioStatEntry[];
767 io_serviced_recursive: BlkioStatEntry[];
768 io_queue_recursive: BlkioStatEntry[];
769 io_service_time_recursive: BlkioStatEntry[];
770 io_wait_time_recursive: BlkioStatEntry[];
771 io_merged_recursive: BlkioStatEntry[];
772 io_time_recursive: BlkioStatEntry[];
773 sectors_recursive: BlkioStatEntry[];
774 }
775
776 interface StorageStats {
777 read_count_normalized?: number;
778 read_size_bytes?: number;
779 write_count_normalized?: number;
780 write_size_bytes?: number;
781 }
782
783 interface PidsStats {
784 current?: number;
785 limit?: number;
786 }
787
788 interface ContainerStats {
789 read: string;
790 preread: string;
791 pids_stats?: PidsStats;
792 blkio_stats?: BlkioStats;
793 num_procs: number;
794 storage_stats?: StorageStats;
795 networks: NetworkStats;
796 memory_stats: MemoryStats;
797 cpu_stats: CPUStats;
798 precpu_stats: CPUStats;
799 }
800
801 interface HostConfig {
802 AutoRemove?: boolean | undefined;
803 Binds?: string[] | undefined;
804 ContainerIDFile?: string | undefined;
805 LogConfig?:
806 | {
807 Type: string;
808 Config: any;
809 }
810 | undefined;
811 NetworkMode?: string | undefined;
812 PortBindings?: any;
813 RestartPolicy?: HostRestartPolicy | undefined;
814 VolumeDriver?: string | undefined;
815 VolumesFrom?: any;
816 Mounts?: MountConfig | undefined;
817 CapAdd?: any;
818 CapDrop?: any;
819 Dns?: any[] | undefined;
820 DnsOptions?: any[] | undefined;
821 DnsSearch?: string[] | undefined;
822 ExtraHosts?: any;
823 GroupAdd?: string[] | undefined;
824 IpcMode?: string | undefined;
825 Cgroup?: string | undefined;
826 Links?: any;
827 OomScoreAdj?: number | undefined;
828 PidMode?: string | undefined;
829 Privileged?: boolean | undefined;
830 PublishAllPorts?: boolean | undefined;
831 ReadonlyRootfs?: boolean | undefined;
832 SecurityOpt?: any;
833 StorageOpt?: { [option: string]: string } | undefined;
834 Tmpfs?: { [dir: string]: string } | undefined;
835 UTSMode?: string | undefined;
836 UsernsMode?: string | undefined;
837 ShmSize?: number | undefined;
838 Sysctls?: { [index: string]: string } | undefined;
839 Runtime?: string | undefined;
840 ConsoleSize?: number[] | undefined;
841 Isolation?: string | undefined;
842 MaskedPaths?: string[] | undefined;
843 ReadonlyPaths?: string[] | undefined;
844 CpuShares?: number | undefined;
845 CgroupParent?: string | undefined;
846 BlkioWeight?: number | undefined;
847 BlkioWeightDevice?: any;
848 BlkioDeviceReadBps?: any;
849 BlkioDeviceWriteBps?: any;
850 BlkioDeviceReadIOps?: any;
851 BlkioDeviceWriteIOps?: any;
852 CpuPeriod?: number | undefined;
853 CpuQuota?: number | undefined;
854 CpusetCpus?: string | undefined;
855 CpusetMems?: string | undefined;
856 Devices?: any;
857 DeviceCgroupRules?: string[] | undefined;
858 DeviceRequests?: DeviceRequest[] | undefined;
859 DiskQuota?: number | undefined;
860 KernelMemory?: number | undefined;
861 Memory?: number | undefined;
862 MemoryReservation?: number | undefined;
863 MemorySwap?: number | undefined;
864 MemorySwappiness?: number | undefined;
865 NanoCpus?: number | undefined;
866 OomKillDisable?: boolean | undefined;
867 Init?: boolean | undefined;
868 PidsLimit?: number | undefined;
869 Ulimits?: Ulimit[] | undefined;
870 CpuCount?: number | undefined;
871 CpuPercent?: number | undefined;
872 CpuRealtimePeriod?: number | undefined;
873 CpuRealtimeRuntime?: number | undefined;
874 }
875
876 interface ImageInspectInfo {
877 Id: string;
878 RepoTags: string[];
879 RepoDigests: string[];
880 Parent: string;
881 Comment: string;
882 Created: string;
883 Container: string;
884 ContainerConfig: {
885 Hostname: string;
886 Domainname: string;
887 User: string;
888 AttachStdin: boolean;
889 AttachStdout: boolean;
890 AttachStderr: boolean;
891 ExposedPorts: { [portAndProtocol: string]: {} };
892 Tty: boolean;
893 OpenStdin: boolean;
894 StdinOnce: boolean;
895 Env: string[];
896 Cmd: string[];
897 ArgsEscaped: boolean;
898 Image: string;
899 Volumes: { [path: string]: {} };
900 WorkingDir: string;
901 Entrypoint?: string | string[] | undefined;
902 OnBuild?: any[] | undefined;
903 Labels: { [label: string]: string };
904 };
905 DockerVersion: string;
906 Author: string;
907 Config: {
908 Hostname: string;
909 Domainname: string;
910 User: string;
911 AttachStdin: boolean;
912 AttachStdout: boolean;
913 AttachStderr: boolean;
914 ExposedPorts: { [portAndProtocol: string]: {} };
915 Tty: boolean;
916 OpenStdin: boolean;
917 StdinOnce: boolean;
918 Env: string[];
919 Cmd: string[];
920 ArgsEscaped: boolean;
921 Image: string;
922 Volumes: { [path: string]: {} };
923 WorkingDir: string;
924 Entrypoint?: string | string[] | undefined;
925 OnBuild: any[];
926 Labels: { [label: string]: string };
927 };
928 Architecture: string;
929 Os: string;
930 Size: number;
931 VirtualSize: number;
932 GraphDriver: {
933 Name: string;
934 Data: {
935 DeviceId: string;
936 DeviceName: string;
937 DeviceSize: string;
938 };
939 };
940 RootFS: {
941 Type: string;
942 Layers?: string[] | undefined;
943 BaseLayer?: string | undefined;
944 };
945 }
946
947 interface ImageBuildOptions {
948 authconfig?: AuthConfig | undefined;
949 registryconfig?: RegistryConfig | undefined;
950 abortSignal?: AbortSignal;
951
952 dockerfile?: string | undefined;
953 t?: string | undefined;
954 extrahosts?: string | undefined;
955 remote?: string | undefined;
956 q?: boolean | undefined;
957 cachefrom?: string | undefined;
958 pull?: string | undefined;
959 rm?: boolean | undefined;
960 forcerm?: boolean | undefined;
961 memory?: number | undefined;
962 memswap?: number | undefined;
963 cpushares?: number | undefined;
964 cpusetcpus?: number | undefined;
965 cpuperiod?: number | undefined;
966 cpuquota?: number | undefined;
967 buildargs?: { [key: string]: string } | undefined;
968 shmsize?: number | undefined;
969 squash?: boolean | undefined;
970 labels?: { [key: string]: string } | undefined;
971 networkmode?: string | undefined;
972 platform?: string | undefined;
973 target?: string | undefined;
974 outputs?: string | undefined;
975 nocache?: boolean | undefined;
976
977 /**
978 * Version of the builder backend to use.
979 * - `1` is the first generation classic (deprecated) builder in the Docker daemon (default)
980 * - `2` is [BuildKit](https://github.com/moby/buildkit)
981 */
982 version?: "1" | "2" | undefined;
983 }
984
985 interface ImageDistributionOptions {
986 authconfig?: AuthConfig | undefined;
987 abortSignal?: AbortSignal;
988 }
989
990 interface ImagePushOptions {
991 tag?: string | undefined;
992 authconfig?: AuthConfig | undefined;
993 abortSignal?: AbortSignal;
994 }
995
996 interface ImageTagOptions {
997 abortSignal?: AbortSignal;
998 /**
999 * The repository to tag in. For example, someuser/someimage.
1000 */
1001 repo: string;
1002 /**
1003 * The name of the new tag.
1004 */
1005 tag?: string;
1006 }
1007
1008 interface AuthConfig {
1009 username?: string;
1010 password?: string;
1011 auth?: string;
1012 serveraddress?: string;
1013 identitytoken?: string;
1014 registrytoken?: string;
1015 /** @deprecated */
1016 email?: string | undefined;
1017 }
1018
1019 interface RegistryConfig {
1020 [registryAddress: string]: {
1021 username: string;
1022 password: string;
1023 };
1024 }
1025
1026 interface PortBinding {
1027 HostIp?: string | undefined;
1028 HostPort?: string | undefined;
1029 }
1030
1031 interface PortMap {
1032 [key: string]: PortBinding[];
1033 }
1034
1035 interface HostRestartPolicy {
1036 Name: string;
1037 MaximumRetryCount?: number | undefined;
1038 }
1039
1040 type LoggingDriverType =
1041 | "json-file"
1042 | "syslog"
1043 | "journald"
1044 | "gelf"
1045 | "fluentd"
1046 | "awslogs"
1047 | "splunk"
1048 | "etwlogs"
1049 | "none";
1050
1051 interface LogConfig {
1052 Type: LoggingDriverType;
1053 Config?: { [key: string]: string } | undefined;
1054 }
1055
1056 interface DeviceMapping {
1057 PathOnHost: string;
1058 PathInContainer: string;
1059 CgroupPermissions: string;
1060 }
1061
1062 interface DeviceRequest {
1063 Driver?: string | undefined;
1064 Count?: number | undefined;
1065 DeviceIDs?: string[] | undefined;
1066 Capabilities?: string[][] | undefined;
1067 Options?: { [key: string]: string } | undefined;
1068 }
1069
1070 /* tslint:disable:interface-name */
1071 interface IPAMConfig {
1072 IPv4Address?: string | undefined;
1073 IPv6Address?: string | undefined;
1074 LinkLocalIPs?: string[] | undefined;
1075 }
1076 /* tslint:enable:interface-name */
1077
1078 interface EndpointSettings {
1079 IPAMConfig?: IPAMConfig | undefined;
1080 Links?: string[] | undefined;
1081 Aliases?: string[] | undefined;
1082 NetworkID?: string | undefined;
1083 EndpointID?: string | undefined;
1084 Gateway?: string | undefined;
1085 IPAddress?: string | undefined;
1086 IPPrefixLen?: number | undefined;
1087 IPv6Gateway?: string | undefined;
1088 GlobalIPv6Address?: string | undefined;
1089 GlobalIPV6PrefixLen?: number | undefined;
1090 MacAddress?: string | undefined;
1091 DriverOpts?: { [key: string]: string } | undefined;
1092 }
1093
1094 interface EndpointsConfig {
1095 [key: string]: EndpointSettings;
1096 }
1097
1098 interface ExecCreateOptions {
1099 AttachStdin?: boolean | undefined;
1100 AttachStdout?: boolean | undefined;
1101 AttachStderr?: boolean | undefined;
1102 DetachKeys?: string | undefined;
1103 Tty?: boolean | undefined;
1104 Env?: string[] | undefined;
1105 Cmd?: string[] | undefined;
1106 Privileged?: boolean | undefined;
1107 User?: string | undefined;
1108 WorkingDir?: string | undefined;
1109 abortSignal?: AbortSignal;
1110 }
1111
1112 interface ExecInspectInfo {
1113 CanRemove: boolean;
1114 DetachKeys: string;
1115 ID: string;
1116 Running: boolean;
1117 ExitCode: number | null;
1118 ProcessConfig: {
1119 privileged: boolean;
1120 user: string;
1121 tty: boolean;
1122 entrypoint: string;
1123 arguments: string[];
1124 };
1125 OpenStdin: boolean;
1126 OpenStderr: boolean;
1127 OpenStdout: boolean;
1128 ContainerID: string;
1129 Pid: number;
1130 }
1131
1132 interface ExecInspectOptions {
1133 abortSignal?: AbortSignal;
1134 }
1135
1136 interface ExecStartOptions {
1137 // hijack and stdin are used by docker-modem
1138 hijack?: boolean | undefined;
1139 stdin?: boolean | undefined;
1140 // Detach and Tty are used by Docker's API
1141 Detach?: boolean | undefined;
1142 Tty?: boolean | undefined;
1143 abortSignal?: AbortSignal;
1144 }
1145
1146 type MountType = "bind" | "volume" | "tmpfs";
1147
1148 type MountConsistency = "default" | "consistent" | "cached" | "delegated";
1149
1150 type MountPropagation = "private" | "rprivate" | "shared" | "rshared" | "slave" | "rslave";
1151
1152 interface MountSettings {
1153 Target: string;
1154 Source: string;
1155 Type: MountType;
1156 ReadOnly?: boolean | undefined;
1157 Consistency?: MountConsistency | undefined;
1158 BindOptions?:
1159 | {
1160 Propagation: MountPropagation;
1161 }
1162 | undefined;
1163 VolumeOptions?:
1164 | {
1165 NoCopy: boolean;
1166 Labels: { [label: string]: string };
1167 DriverConfig: {
1168 Name: string;
1169 Options: { [option: string]: string };
1170 };
1171 }
1172 | undefined;
1173 TmpfsOptions?:
1174 | {
1175 SizeBytes: number;
1176 Mode: number;
1177 }
1178 | undefined;
1179 }
1180
1181 type MountConfig = MountSettings[];
1182
1183 interface ContainerCreateOptions {
1184 name?: string | undefined;
1185 platform?: string | undefined;
1186 Hostname?: string | undefined;
1187 Domainname?: string | undefined;
1188 User?: string | undefined;
1189 ArgsEscaped?: boolean | undefined;
1190 AttachStdin?: boolean | undefined;
1191 AttachStdout?: boolean | undefined;
1192 AttachStderr?: boolean | undefined;
1193 Tty?: boolean | undefined;
1194 OpenStdin?: boolean | undefined;
1195 StdinOnce?: boolean | undefined;
1196 Env?: string[] | undefined;
1197 Cmd?: string[] | undefined;
1198 Entrypoint?: string | string[] | undefined;
1199 Image?: string | undefined;
1200 Labels?: { [label: string]: string } | undefined;
1201 Volumes?: { [volume: string]: {} } | undefined;
1202 WorkingDir?: string | undefined;
1203 NetworkDisabled?: boolean | undefined;
1204 MacAddress?: string | undefined;
1205 ExposedPorts?: { [port: string]: {} } | undefined;
1206 StopSignal?: string | undefined;
1207 StopTimeout?: number | undefined;
1208 Healthcheck?: HealthConfig | undefined;
1209 HostConfig?: HostConfig | undefined;
1210 OnBuild?: string[] | undefined;
1211 Shell?: string[] | undefined;
1212 NetworkingConfig?:
1213 | {
1214 EndpointsConfig?: EndpointsConfig | undefined;
1215 }
1216 | undefined;
1217 abortSignal?: AbortSignal;
1218 }
1219
1220 interface ContainerInspectOptions {
1221 abortSignal?: AbortSignal;
1222 }
1223
1224 interface ContainerStartOptions {
1225 detachKeys?: string;
1226 abortSignal?: AbortSignal;
1227 }
1228
1229 interface ContainerRemoveOptions {
1230 v?: boolean | undefined;
1231 force?: boolean | undefined;
1232 link?: boolean | undefined;
1233 }
1234
1235 interface KeyObject {
1236 pem: string | Buffer;
1237 passphrase?: string | undefined;
1238 }
1239
1240 interface DockerOptions {
1241 socketPath?: string | undefined;
1242 host?: string | undefined;
1243 port?: number | string | undefined;
1244 username?: string | undefined;
1245 headers?: { [name: string]: string };
1246 ca?: string | string[] | Buffer | Buffer[] | undefined;
1247 cert?: string | string[] | Buffer | Buffer[] | undefined;
1248 key?: string | string[] | Buffer | Buffer[] | KeyObject[] | undefined;
1249 protocol?: "https" | "http" | "ssh" | undefined;
1250 timeout?: number | undefined;
1251 version?: string | undefined;
1252 sshAuthAgent?: string | undefined;
1253 sshOptions?: ConnectConfig | undefined;
1254 Promise?: typeof Promise | undefined;
1255 }
1256
1257 interface GetEventsOptions {
1258 since?: number | undefined;
1259 until?: number | undefined;
1260 filters?:
1261 | string
1262 | {
1263 config?: string | undefined;
1264 container?: string[] | undefined;
1265 daemon?: string[] | undefined;
1266 event?: string[] | undefined;
1267 image?: string[] | undefined;
1268 label?: string[] | undefined;
1269 network?: string[] | undefined;
1270 node?: string[] | undefined;
1271 plugin?: string[] | undefined;
1272 scope?: Array<"local" | "swarm"> | undefined;
1273 secret?: string[] | undefined;
1274 service?: string[] | undefined;
1275 type?:
1276 | Array<
1277 | "container"
1278 | "image"
1279 | "volume"
1280 | "network"
1281 | "daemon"
1282 | "plugin"
1283 | "service"
1284 | "node"
1285 | "secret"
1286 | "config"
1287 >
1288 | undefined;
1289 volume?: string[] | undefined;
1290 }
1291 | undefined;
1292 abortSignal?: AbortSignal;
1293 }
1294
1295 interface SecretVersion {
1296 Index: number;
1297 }
1298
1299 interface Annotations {
1300 Name?: string | undefined;
1301 Labels?: { [name: string]: string } | undefined;
1302 }
1303
1304 interface ResourceLimits {
1305 NanoCPUs?: number | undefined;
1306 MemoryBytes?: number | undefined;
1307 Pids?: number | undefined;
1308 }
1309
1310 interface NamedGenericResource {
1311 Kind?: string | undefined;
1312 Value?: string | undefined;
1313 }
1314
1315 interface DiscreteGenericResource {
1316 Kind?: string | undefined;
1317 Value?: number | undefined;
1318 }
1319
1320 type GenericResource = NamedGenericResource | DiscreteGenericResource;
1321
1322 interface TaskRestartPolicy {
1323 Condition?: string | undefined;
1324 Delay?: number | undefined;
1325 MaxAttempts?: number | undefined;
1326 Window?: number | undefined;
1327 }
1328
1329 interface Resources {
1330 NanoCPUs?: number | undefined;
1331 MemoryBytes?: number | undefined;
1332 GenericResources?: GenericResource[] | undefined;
1333 }
1334
1335 interface ResourceRequirements {
1336 Limits?: ResourceLimits | undefined;
1337 Reservations?: Resources | undefined;
1338 }
1339
1340 interface Placement {
1341 Constraints?: string[] | undefined;
1342 Preferences?: Array<{ Spread: { SpreadDescriptor: string } }> | undefined;
1343 MaxReplicas?: number | undefined;
1344 Platforms?:
1345 | Array<{
1346 Architecture: string;
1347 OS: string;
1348 }>
1349 | undefined;
1350 }
1351
1352 interface NetworkAttachmentConfig {
1353 Target?: string | undefined;
1354 Aliases?: string[] | undefined;
1355 DriverOpts?: { [key: string]: string } | undefined;
1356 }
1357
1358 interface Privileges {
1359 CredentialSpec?:
1360 | {
1361 Config?: string | undefined;
1362 File?: string | undefined;
1363 Registry?: string | undefined;
1364 }
1365 | undefined;
1366 SELinuxContext?:
1367 | {
1368 Disable?: boolean | undefined;
1369 User?: string | undefined;
1370 Role?: string | undefined;
1371 Type?: string | undefined;
1372 Level?: string | undefined;
1373 }
1374 | undefined;
1375 }
1376
1377 interface HealthConfig {
1378 Test?: string[] | undefined;
1379 Interval?: number | undefined;
1380 Timeout?: number | undefined;
1381 StartPeriod?: number | undefined;
1382 Retries?: number | undefined;
1383 }
1384
1385 interface DNSConfig {
1386 Nameservers?: string[] | undefined;
1387 Search?: string[] | undefined;
1388 Options?: string[] | undefined;
1389 }
1390
1391 interface ConfigReference {
1392 File?:
1393 | {
1394 Name?: string | undefined;
1395 UID?: string | undefined;
1396 GID?: string | undefined;
1397 Mode: number | undefined;
1398 }
1399 | undefined;
1400 ConfigID?: string | undefined;
1401 ConfigName?: string | undefined;
1402 }
1403
1404 interface SecretReference {
1405 File?:
1406 | {
1407 Name?: string | undefined;
1408 UID?: string | undefined;
1409 GID?: string | undefined;
1410 Mode?: number | undefined;
1411 }
1412 | undefined;
1413 SecretID?: string | undefined;
1414 SecretName?: string | undefined;
1415 }
1416
1417 interface Ulimit {
1418 Name?: string | undefined;
1419 Hard?: number | undefined;
1420 Soft?: number | undefined;
1421 }
1422
1423 interface ContainerSpec {
1424 Image?: string | undefined;
1425 Labels?: { [label: string]: string } | undefined;
1426 Command?: string[] | undefined;
1427 Args?: string[] | undefined;
1428 Hostname?: string | undefined;
1429 Env?: string[] | undefined;
1430 Dir?: string | undefined;
1431 User?: string | undefined;
1432 Groups?: string[] | undefined;
1433 Privileges?: Privileges | undefined;
1434 Init?: boolean | undefined;
1435 TTY?: boolean | undefined;
1436 OpenStdin?: boolean | undefined;
1437 ReadOnly?: boolean | undefined;
1438 Mounts?: MountSettings[] | undefined;
1439 StopSignal?: string | undefined;
1440 StopGracePeriod?: number | undefined;
1441 HealthCheck?: HealthConfig | undefined;
1442 Hosts?: string[] | undefined;
1443 DNSConfig?: DNSConfig | undefined;
1444 Configs?: ConfigReference[] | undefined;
1445 Secrets?: SecretReference[] | undefined;
1446 Isolation?: string | undefined;
1447 Sysctls?: { [key: string]: string } | undefined;
1448 CapabilityAdd?: string[] | undefined;
1449 CapabilityDrop?: string[] | undefined;
1450 Ulimits?: Ulimit[] | undefined;
1451 }
1452
1453 interface PluginSpec {
1454 Name?: string | undefined;
1455 Remote?: string | undefined;
1456 Privileges?:
1457 | {
1458 Name?: string | undefined;
1459 Description?: string | undefined;
1460 Value?: string[] | undefined;
1461 }
1462 | undefined;
1463 Disabled?: boolean | undefined;
1464 Env?: string[] | undefined;
1465 }
1466
1467 interface TaskSpecBase {
1468 Resources?: ResourceRequirements | undefined;
1469 RestartPolicy?: TaskRestartPolicy | undefined;
1470 Placement?: Placement | undefined;
1471 Networks?: NetworkAttachmentConfig[] | undefined;
1472 LogDriver?:
1473 | {
1474 Name?: string | undefined;
1475 Options?: { [key: string]: string } | undefined;
1476 }
1477 | undefined;
1478 ForceUpdate?: number | undefined;
1479 Runtime?: string | undefined;
1480 }
1481
1482 interface ContainerTaskSpec extends TaskSpecBase {
1483 ContainerSpec?: ContainerSpec | undefined;
1484 }
1485
1486 interface PluginTaskSpec extends TaskSpecBase {
1487 Runtime: "plugin";
1488 PluginSpec: PluginSpec;
1489 }
1490
1491 interface NetworkAttachmentTaskSpec extends TaskSpecBase {
1492 Runtime: "attachment";
1493 NetworkAttachmentSpec: {
1494 ContainerID: string;
1495 };
1496 }
1497
1498 type TaskSpec = ContainerTaskSpec | PluginTaskSpec | NetworkAttachmentTaskSpec;
1499
1500 interface ServiceMode {
1501 Replicated?: { Replicas?: number | undefined } | undefined;
1502 Global?: {} | undefined;
1503 ReplicatedJob?:
1504 | {
1505 MaxConcurrent?: number | undefined;
1506 TotalCompletions?: number | undefined;
1507 }
1508 | undefined;
1509 GlobalJob?: {} | undefined;
1510 }
1511
1512 interface UpdateConfig {
1513 Parallelism: number;
1514 Delay?: number | undefined;
1515 FailureAction?: string | undefined;
1516 Monitor?: number | undefined;
1517 MaxFailureRatio?: number | undefined;
1518 Order: string;
1519 }
1520
1521 interface PortConfig {
1522 Name?: string | undefined;
1523 Protocol?: "tcp" | "udp" | "sctp" | undefined;
1524 TargetPort?: number | undefined;
1525 PublishedPort?: number | undefined;
1526 PublishMode?: "ingress" | "host" | undefined;
1527 }
1528
1529 interface EndpointSpec {
1530 Mode?: string | undefined;
1531 Ports?: PortConfig[] | undefined;
1532 }
1533
1534 interface EndpointVirtualIP {
1535 NetworkID?: string | undefined;
1536 Addr?: string | undefined;
1537 }
1538
1539 interface Endpoint {
1540 Spec?: EndpointSpec | undefined;
1541 Ports?: PortConfig[] | undefined;
1542 VirtualIPs?: EndpointVirtualIP[] | undefined;
1543 }
1544
1545 interface ServiceSpec extends Annotations {
1546 TaskTemplate?: TaskSpec | undefined;
1547 Mode?: ServiceMode | undefined;
1548 UpdateConfig?: UpdateConfig | undefined;
1549 RollbackConfig?: UpdateConfig | undefined;
1550 Networks?: NetworkAttachmentConfig[] | undefined;
1551 EndpointSpec?: EndpointSpec | undefined;
1552 }
1553
1554 interface CreateServiceOptions extends ServiceSpec {
1555 authconfig?: AuthConfig | undefined;
1556 abortSignal?: AbortSignal;
1557 }
1558
1559 interface ContainerListOptions {
1560 abortSignal?: AbortSignal;
1561 /**
1562 * Return all containers. By default, only running containers are shown
1563 * @default false
1564 */
1565 all?: boolean;
1566 /**
1567 * Return this number of most recently created containers, including non-running ones.
1568 */
1569 limit?: number;
1570 /**
1571 * Return the size of container as fields `SizeRw` and `SizeRootFs`.
1572 * @default false
1573 */
1574 size?: boolean;
1575 /**
1576 * Filters to process on the container list, encoded as JSON (a map[string][]string).
1577 * A dictionary of key/value list is also accepted.
1578 */
1579 filters?: string | { [key: string]: string[] };
1580 }
1581
1582 interface ServiceListOptions {
1583 filters?:
1584 | {
1585 id?: string[] | undefined;
1586 label?: string[] | undefined;
1587 mode?: Array<"replicated" | "global"> | undefined;
1588 name?: string[] | undefined;
1589 }
1590 | string
1591 | undefined;
1592 status?: boolean | undefined;
1593 abortSignal?: AbortSignal;
1594 }
1595
1596 interface Version {
1597 Index?: number | undefined;
1598 }
1599
1600 interface Meta {
1601 Version?: Version | undefined;
1602 CreatedAt?: string | undefined;
1603 UpdatedAt?: string | undefined;
1604 }
1605
1606 type UpdateState =
1607 | "updating"
1608 | "paused"
1609 | "completed"
1610 | "rollback_started"
1611 | "rollback_paused"
1612 | "rollback_completed";
1613
1614 interface UpdateStatus {
1615 State?: UpdateState | undefined;
1616 StartedAt?: string | undefined;
1617 CompletedAt?: string | undefined;
1618 Message?: string | undefined;
1619 }
1620
1621 interface ServiceStatus {
1622 RunningTasks: number;
1623 DesiredTasks: number;
1624 CompletedTasks: number;
1625 }
1626
1627 interface JobStatus {
1628 JobIteration: Version;
1629 LastExecution?: string | undefined;
1630 }
1631
1632 interface Service extends Meta {
1633 ID: string;
1634 Spec?: ServiceSpec | undefined;
1635 PreviousSpec?: ServiceSpec | undefined;
1636 Endpoint?: Endpoint | undefined;
1637 UpdateStatus?: UpdateStatus | undefined;
1638 ServiceStatus?: ServiceStatus | undefined;
1639 JobStatus?: JobStatus | undefined;
1640 }
1641
1642 interface OrchestrationConfig {
1643 TaskHistoryRetentionLimit?: number | undefined;
1644 }
1645
1646 interface RaftConfig {
1647 SnapshotInterval?: number | undefined;
1648 KeepOldSnapshots?: number | undefined;
1649 LogEntriesForSlowFollowers?: number | undefined;
1650 ElectionTick?: number | undefined;
1651 HeartbeatTick?: number | undefined;
1652 }
1653
1654 interface DispatcherConfig {
1655 HeartbeatPeriod?: Duration | undefined;
1656 }
1657
1658 type ExternalCAProtocol = "cfssl" | string;
1659
1660 interface ExternalCA {
1661 Protocol: ExternalCAProtocol;
1662 URL: string;
1663 Options?: { [key: string]: string } | undefined;
1664 CACert: string;
1665 }
1666
1667 interface CAConfig {
1668 NodeCertExpiry?: Duration | undefined;
1669 ExternalCAs?: ExternalCA[] | undefined;
1670 SigningCACert?: string | undefined;
1671 SigningCAKey?: string | undefined;
1672 ForceRotate?: number | undefined;
1673 }
1674
1675 interface TaskDefaults {
1676 LogDriver?: Driver | undefined;
1677 }
1678
1679 interface EncryptionConfig {
1680 AutoLockManagers: boolean;
1681 }
1682
1683 interface Spec extends Annotations {
1684 Orchestration?: OrchestrationConfig | undefined;
1685 Raft: RaftConfig;
1686 Dispatcher?: DispatcherConfig | undefined;
1687 CAConfig?: CAConfig | undefined;
1688 TaskDefaults?: TaskDefaults | undefined;
1689 EncryptionConfig?: EncryptionConfig | undefined;
1690 }
1691
1692 interface TLSInfo {
1693 TrustRoot?: string | undefined;
1694 CertIssuerSubject?: string | undefined;
1695 CertIssuerPublicKey?: string | undefined;
1696 }
1697
1698 interface ClusterInfo extends Meta {
1699 ID: string;
1700 Spec: Spec;
1701 TLSInfo: TLSInfo;
1702 RootRotationInProgress: boolean;
1703 DefaultAddrPool: string[];
1704 SubnetSize: number;
1705 DataPathPort: number;
1706 }
1707
1708 interface JoinTokens {
1709 Worker: string;
1710 Manager: string;
1711 }
1712
1713 interface Swarm extends ClusterInfo {
1714 JoinTokens: JoinTokens;
1715 }
1716
1717 interface Driver {
1718 Name: string;
1719 Options?: { [key: string]: string } | undefined;
1720 }
1721
1722 interface SecretSpec extends Annotations {
1723 Data?: string | undefined;
1724 Driver?: Driver | undefined;
1725 Templating?: Driver | undefined;
1726 }
1727
1728 interface Secret extends Meta {
1729 ID: string;
1730 Spec?: SecretSpec | undefined;
1731 }
1732
1733 interface ConfigInfo {
1734 ID: string;
1735 Version: SecretVersion;
1736 CreatedAt: string;
1737 UpdatedAt?: string | undefined;
1738 Spec?: ConfigSpec | undefined;
1739 }
1740
1741 interface ConfigSpec {
1742 Name: string;
1743 Labels: { [label: string]: string };
1744 Data: string;
1745 }
1746
1747 interface ConfigVersion {
1748 Index: number;
1749 }
1750
1751 interface PluginInfo {
1752 Id?: string | undefined;
1753 Name: string;
1754 Enabled: boolean;
1755 Settings: PluginSettings;
1756 PluginReference?: string | undefined;
1757 Config: PluginConfig;
1758 }
1759
1760 type PluginInspectInfo = PluginInfo;
1761
1762 interface PluginSettings {
1763 Mounts: PluginMount[];
1764 Env: string[];
1765 Args: string[];
1766 Devices: PluginDevice[];
1767 }
1768
1769 interface PluginConfig {
1770 Description: string;
1771 Documentation: string;
1772 Interface: any;
1773 Entrypoint: string[];
1774 WorkDir: string;
1775 User?: User | undefined;
1776 Network: Network;
1777 Linux: Linux;
1778 PropagatedMount: string;
1779 Mounts: PluginMount[];
1780 Env: PluginEnv[];
1781 Args: Args;
1782 rootfs: any;
1783 }
1784
1785 interface Interface {
1786 Types: PluginInterfaceType[];
1787 Socket: string;
1788 }
1789
1790 interface PluginInterfaceType {
1791 Prefix: string;
1792 Capability: string;
1793 Version: string;
1794 }
1795
1796 interface PluginMount {
1797 Name: string;
1798 Description: string;
1799 Settable: string[];
1800 Source: string;
1801 Destination: string;
1802 Type: string;
1803 Options: string[];
1804 }
1805
1806 interface Linux {
1807 Capabilities: string[];
1808 AllowAllDevices: boolean;
1809 Devices: PluginDevice[];
1810 }
1811
1812 interface PluginDevice {
1813 Name: string;
1814 Description: string;
1815 Settable: string[];
1816 Path: string;
1817 }
1818
1819 interface Network {
1820 Type: string;
1821 }
1822
1823 interface PluginEnv {
1824 Name: string;
1825 Description: string;
1826 Settable: string[];
1827 Value: string;
1828 }
1829
1830 interface Args {
1831 Name: string;
1832 Description: string;
1833 Settable: string[];
1834 Value: string;
1835 }
1836
1837 interface User {
1838 UID: number;
1839 GID: number;
1840 }
1841
1842 interface ListImagesOptions {
1843 all?: boolean | undefined;
1844 filters?: string | { [key: string]: string[] } | undefined;
1845 digests?: boolean | undefined;
1846 abortSignal?: AbortSignal;
1847 }
1848
1849 interface ImageDistributionPlatformInfo {
1850 architecture: string;
1851 os: string;
1852 "os.version": string;
1853 "os.features": string[];
1854 variant: string;
1855 }
1856
1857 interface ImageDistributionDescriptorInfo {
1858 mediaType: string;
1859 digest: string;
1860 size: number;
1861 }
1862
1863 interface ImageDistributionInfo {
1864 Descriptor: ImageDistributionDescriptorInfo;
1865 Platforms: ImageDistributionPlatformInfo[];
1866 }
1867
1868 interface ImageRemoveInfo {
1869 Untagged: string;
1870 Deleted: string;
1871 }
1872
1873 interface ImageRemoveOptions {
1874 force?: boolean | undefined;
1875 noprune?: boolean | undefined;
1876 abortSignal?: AbortSignal;
1877 }
1878
1879 interface PruneImagesInfo {
1880 ImagesDeleted: ImageRemoveInfo[];
1881 SpaceReclaimed: number;
1882 }
1883
1884 interface PruneVolumesInfo {
1885 VolumesDeleted: string[];
1886 SpaceReclaimed: number;
1887 }
1888
1889 interface PruneContainersInfo {
1890 ContainersDeleted: string[];
1891 SpaceReclaimed: number;
1892 }
1893
1894 interface PruneNetworksInfo {
1895 NetworksDeleted: string[];
1896 }
1897
1898 interface ContainerWaitOptions {
1899 /** Since v1.30 */
1900 condition?: "not-running" | "next-exit" | "removed" | undefined;
1901 abortSignal?: AbortSignal;
1902 }
1903
1904 interface ContainerLogsOptions {
1905 stdout?: boolean | undefined;
1906 stderr?: boolean | undefined;
1907 follow?: boolean | undefined;
1908 since?: number | string | undefined;
1909 until?: number | string | undefined;
1910 details?: boolean | undefined;
1911 tail?: number | undefined;
1912 timestamps?: boolean | undefined;
1913 abortSignal?: AbortSignal;
1914 }
1915
1916 interface ContainerAttachOptions {
1917 detachKeys?: string | undefined;
1918 hijack?: boolean | undefined;
1919 logs?: boolean | undefined;
1920 stream?: boolean | undefined;
1921 stdin?: boolean | undefined;
1922 stdout?: boolean | undefined;
1923 stderr?: boolean | undefined;
1924 abortSignal?: AbortSignal;
1925 }
1926
1927 interface ContainerStopOptions {
1928 signal?: string;
1929 /** Number of seconds to wait before killing the container */
1930 t?: number;
1931 abortSignal?: AbortSignal;
1932 }
1933
1934 interface ImageBuildContext {
1935 context: string;
1936 src: string[];
1937 }
1938
1939 interface DockerVersion {
1940 ApiVersion: string;
1941 Arch: string;
1942 BuildTime: Date;
1943 Components: Array<{
1944 Details: {
1945 ApiVersion: string;
1946 Arch: string;
1947 BuildTime: Date;
1948 Experimental: string;
1949 GitCommit: string;
1950 GoVersion: string;
1951 KernelVersion: string;
1952 Os: string;
1953 };
1954 Name: string;
1955 Version: string;
1956 }>;
1957 GitCommit: string;
1958 GoVersion: string;
1959 KernelVersion: string;
1960 MinAPIVersion: string;
1961 Os: string;
1962 Platform: {
1963 Name: string;
1964 };
1965 Version: string;
1966 }
1967}
1968
1969type Callback<T> = (error?: any, result?: T) => void;
1970
1971declare class Dockerode {
1972 constructor(options?: Dockerode.DockerOptions);
1973
1974 createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback<Dockerode.Container>): void;
1975 createContainer(options: Dockerode.ContainerCreateOptions): Promise<Dockerode.Container>;
1976
1977 createImage(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1978 createImage(auth: any, options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1979 createImage(options: {}): Promise<NodeJS.ReadableStream>;
1980 createImage(auth: any, options: {}): Promise<NodeJS.ReadableStream>;
1981
1982 loadImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1983 loadImage(file: string | NodeJS.ReadableStream, callback: Callback<NodeJS.ReadableStream>): void;
1984 loadImage(file: string | NodeJS.ReadableStream, options?: {}): Promise<NodeJS.ReadableStream>;
1985
1986 importImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1987 importImage(file: string | NodeJS.ReadableStream, callback: Callback<NodeJS.ReadableStream>): void;
1988 importImage(file: string | NodeJS.ReadableStream, options?: {}): Promise<NodeJS.ReadableStream>;
1989
1990 checkAuth(options: any, callback: Callback<any>): void;
1991 checkAuth(options: any): Promise<any>;
1992
1993 buildImage(
1994 file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext,
1995 options: Dockerode.ImageBuildOptions,
1996 callback: Callback<NodeJS.ReadableStream>,
1997 ): void;
1998 buildImage(
1999 file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext,
2000 callback: Callback<NodeJS.ReadableStream>,
2001 ): void;
2002 buildImage(
2003 file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext,
2004 options?: Dockerode.ImageBuildOptions,
2005 ): Promise<NodeJS.ReadableStream>;
2006
2007 getContainer(id: string): Dockerode.Container;
2008
2009 getImage(name: string): Dockerode.Image;
2010
2011 getVolume(name: string): Dockerode.Volume;
2012
2013 getPlugin(name: string, remote: any): Dockerode.Plugin;
2014
2015 getService(id: string): Dockerode.Service;
2016
2017 getTask(id: string): Dockerode.Task;
2018
2019 getNode(id: string): Dockerode.Node;
2020
2021 getNetwork(id: string): Dockerode.Network;
2022
2023 getSecret(id: string): Dockerode.Secret;
2024
2025 getExec(id: string): Dockerode.Exec;
2026
2027 getConfig(id: string): Dockerode.Config;
2028
2029 listContainers(options: Dockerode.ContainerListOptions, callback: Callback<Dockerode.ContainerInfo[]>): void;
2030 listContainers(callback: Callback<Dockerode.ContainerInfo[]>): void;
2031 listContainers(options?: Dockerode.ContainerListOptions): Promise<Dockerode.ContainerInfo[]>;
2032
2033 listImages(options: Dockerode.ListImagesOptions, callback: Callback<Dockerode.ImageInfo[]>): void;
2034 listImages(callback: Callback<Dockerode.ImageInfo[]>): void;
2035 listImages(options?: Dockerode.ListImagesOptions): Promise<Dockerode.ImageInfo[]>;
2036
2037 listServices(options: Dockerode.ServiceListOptions, callback: Callback<Dockerode.Service[]>): void;
2038 listServices(callback: Callback<Dockerode.Service[]>): void;
2039 listServices(options?: Dockerode.ServiceListOptions): Promise<Dockerode.Service[]>;
2040
2041 listNodes(options: Dockerode.NodeListOptions, callback: Callback<any[]>): void;
2042 listNodes(callback: Callback<any[]>): void;
2043 listNodes(options?: Dockerode.NodeListOptions): Promise<any[]>;
2044
2045 listTasks(options: {}, callback: Callback<any[]>): void;
2046 listTasks(callback: Callback<any[]>): void;
2047 listTasks(options?: {}): Promise<any[]>;
2048
2049 listSecrets(options: {}, callback: Callback<Dockerode.Secret[]>): void;
2050 listSecrets(callback: Callback<Dockerode.Secret[]>): void;
2051 listSecrets(options?: {}): Promise<Dockerode.Secret[]>;
2052
2053 listPlugins(options: {}, callback: Callback<Dockerode.PluginInfo[]>): void;
2054 listPlugins(callback: Callback<Dockerode.PluginInfo[]>): void;
2055 listPlugins(options?: {}): Promise<Dockerode.PluginInfo[]>;
2056
2057 listVolumes(
2058 options: Dockerode.VolumeListOptions,
2059 callback: Callback<{
2060 Volumes: Dockerode.VolumeInspectInfo[];
2061 Warnings: string[];
2062 }>,
2063 ): void;
2064 listVolumes(
2065 callback: Callback<{
2066 Volumes: Dockerode.VolumeInspectInfo[];
2067 Warnings: string[];
2068 }>,
2069 ): void;
2070 listVolumes(options?: Dockerode.VolumeListOptions): Promise<{
2071 Volumes: Dockerode.VolumeInspectInfo[];
2072 Warnings: string[];
2073 }>;
2074
2075 listNetworks(options: Dockerode.NetworkListOptions, callback: Callback<Dockerode.NetworkInspectInfo[]>): void;
2076 listNetworks(callback: Callback<Dockerode.NetworkInspectInfo[]>): void;
2077 listNetworks(options?: Dockerode.NetworkListOptions): Promise<Dockerode.NetworkInspectInfo[]>;
2078
2079 listConfigs(options: {}, callback: Callback<Dockerode.ConfigInfo[]>): void;
2080 listConfigs(callback: Callback<Dockerode.ConfigInfo[]>): void;
2081 listConfigs(options?: {}): Promise<Dockerode.ConfigInfo[]>;
2082
2083 createSecret(options: {}, callback: Callback<any>): void;
2084 createSecret(options: {}): Promise<any>;
2085
2086 createConfig(options: {}, callback: Callback<any>): void;
2087 createConfig(options: {}): Promise<any>;
2088
2089 createPlugin(options: {}, callback: Callback<any>): void;
2090 createPlugin(options: {}): Promise<any>;
2091
2092 createVolume(options: Dockerode.VolumeCreateOptions, callback: Callback<Dockerode.Volume>): void;
2093 createVolume(callback: Callback<Dockerode.Volume>): void;
2094 createVolume(options?: Dockerode.VolumeCreateOptions): Promise<Dockerode.VolumeCreateResponse>;
2095
2096 createService(options: Dockerode.CreateServiceOptions, callback: Callback<Dockerode.Service>): void;
2097 createService(options: Dockerode.CreateServiceOptions): Promise<Dockerode.Service>;
2098 createService(auth: Dockerode.AuthConfig, options: Dockerode.ServiceSpec): Promise<Dockerode.Service>;
2099
2100 createNetwork(options: Dockerode.NetworkCreateOptions, callback: Callback<Dockerode.Network>): void;
2101 createNetwork(options: Dockerode.NetworkCreateOptions): Promise<Dockerode.Network>;
2102
2103 searchImages(options: {}, callback: Callback<any>): void;
2104 searchImages(options: {}): Promise<any>;
2105
2106 pruneImages(options: {}, callback: Callback<Dockerode.PruneImagesInfo>): void;
2107 pruneImages(callback: Callback<Dockerode.PruneImagesInfo>): void;
2108 pruneImages(options?: {}): Promise<Dockerode.PruneImagesInfo>;
2109
2110 pruneContainers(options: {}, callback: Callback<Dockerode.PruneContainersInfo>): void;
2111 pruneContainers(callback: Callback<Dockerode.PruneContainersInfo>): void;
2112 pruneContainers(options?: {}): Promise<Dockerode.PruneContainersInfo>;
2113
2114 pruneVolumes(options: Dockerode.VolumePruneOptions, callback: Callback<Dockerode.PruneVolumesInfo>): void;
2115 pruneVolumes(callback: Callback<Dockerode.PruneVolumesInfo>): void;
2116 pruneVolumes(options?: Dockerode.VolumePruneOptions): Promise<Dockerode.PruneVolumesInfo>;
2117
2118 pruneNetworks(options: {}, callback: Callback<Dockerode.PruneNetworksInfo>): void;
2119 pruneNetworks(callback: Callback<Dockerode.PruneNetworksInfo>): void;
2120 pruneNetworks(options?: {}): Promise<Dockerode.PruneNetworksInfo>;
2121
2122 info(callback: Callback<any>): void;
2123 info(): Promise<any>;
2124
2125 df(callback: Callback<any>): void;
2126 df(): Promise<any>;
2127
2128 version(callback: Callback<Dockerode.DockerVersion>): void;
2129 version(): Promise<Dockerode.DockerVersion>;
2130
2131 ping(callback: Callback<any>): void;
2132 ping(): Promise<any>;
2133
2134 getEvents(options: Dockerode.GetEventsOptions, callback: Callback<NodeJS.ReadableStream>): void;
2135 getEvents(callback: Callback<NodeJS.ReadableStream>): void;
2136 getEvents(options?: Dockerode.GetEventsOptions): Promise<NodeJS.ReadableStream>;
2137
2138 pull(repoTag: string, options: {}, callback: Callback<NodeJS.ReadableStream>, auth?: {}): Dockerode.Image;
2139 pull(repoTag: string, options?: {}): Promise<NodeJS.ReadableStream>;
2140
2141 run(
2142 image: string,
2143 cmd: string[],
2144 outputStream: NodeJS.WritableStream | NodeJS.WritableStream[],
2145 createOptions: Dockerode.ContainerCreateOptions,
2146 startOptions: Dockerode.ContainerStartOptions,
2147 callback: Callback<any>,
2148 ): events.EventEmitter;
2149 run(
2150 image: string,
2151 cmd: string[],
2152 outputStream: NodeJS.WritableStream | NodeJS.WritableStream[],
2153 createOptions: Dockerode.ContainerCreateOptions,
2154 callback: Callback<any>,
2155 ): events.EventEmitter;
2156 run(
2157 image: string,
2158 cmd: string[],
2159 outputStream: NodeJS.WritableStream | NodeJS.WritableStream[],
2160 callback: Callback<any>,
2161 ): events.EventEmitter;
2162 run(
2163 image: string,
2164 cmd: string[],
2165 outputStream: NodeJS.WritableStream | NodeJS.WritableStream[],
2166 createOptions?: Dockerode.ContainerCreateOptions,
2167 startOptions?: Dockerode.ContainerStartOptions,
2168 ): Promise<any>;
2169
2170 swarmInit(options: {}, callback: Callback<any>): void;
2171 swarmInit(options: {}): Promise<any>;
2172
2173 swarmJoin(options: {}, callback: Callback<any>): void;
2174 swarmJoin(options: {}): Promise<any>;
2175
2176 swarmLeave(options: {}, callback: Callback<any>): void;
2177 swarmLeave(options: {}): Promise<any>;
2178
2179 swarmUpdate(options: {}, callback: Callback<any>): void;
2180 swarmUpdate(options: {}): Promise<any>;
2181
2182 swarmInspect(callback: Callback<any>): void;
2183 swarmInspect(): Promise<any>;
2184
2185 modem: DockerModem;
2186}
2187
2188export = Dockerode;