UNPKG

35.3 kBTypeScriptView Raw
1// Type definitions for dockerode 2.5
2// Project: https://github.com/apocas/dockerode
3// Definitions by: Carl Winkler <https://github.com/seikho>
4// Nicolas Laplante <https://github.com/nlaplante>
5// ByeongHun Yoo <https://github.com/isac322>
6// Ray Fang <https://github.com/lazarusx>
7// Marius Meisenzahl <https://github.com/meisenzahl>
8// Rob Moran <https://github.com/thegecko>
9// Cameron Diver <https://github.com/CameronDiver>
10// Pascal Sthamer <https://github.com/p4sca1>
11// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
12// TypeScript Version: 2.2
13
14/// <reference types="node" />
15
16import * as stream from 'stream';
17import * as events from 'events';
18
19// The modem parameter is an instance of docker-modem, which is missing type declarations.
20// https://github.com/apocas/docker-modem
21
22declare namespace Dockerode {
23 class Container {
24 constructor(modem: any, id: string);
25
26 modem: any;
27 id: string;
28
29 inspect(options: {}, callback: Callback<ContainerInspectInfo>): void;
30 inspect(callback: Callback<ContainerInspectInfo>): void;
31 inspect(options?: {}): Promise<ContainerInspectInfo>;
32
33 rename(options: {}, callback: Callback<any>): void;
34 rename(options: {}): Promise<any>;
35
36 update(options: {}, callback: Callback<any>): void;
37 update(options: {}): Promise<any>;
38
39 top(options: {}, callback: Callback<any>): void;
40 top(callback: Callback<any>): void;
41 top(options?: {}): Promise<any>;
42
43 changes(callback: Callback<any>): void;
44 changes(): Promise<any>;
45
46 export(callback: Callback<NodeJS.ReadableStream>): void;
47 export(): Promise<NodeJS.ReadableStream>;
48
49 start(options: {}, callback: Callback<any>): void;
50 start(callback: Callback<any>): void;
51 start(options?: {}): Promise<any>;
52
53 pause(options: {}, callback: Callback<any>): void;
54 pause(callback: Callback<any>): void;
55 pause(options?: {}): Promise<any>;
56
57 unpause(options: {}, callback: Callback<any>): void;
58 unpause(callback: Callback<any>): void;
59 unpause(options?: {}): Promise<any>;
60
61 exec(options: {}, callback: Callback<any>): void;
62 exec(options: {}): Promise<any>;
63
64 commit(options: {}, callback: Callback<any>): void;
65 commit(callback: Callback<any>): void;
66 commit(options?: {}): Promise<any>;
67
68 stop(options: {}, callback: Callback<any>): void;
69 stop(callback: Callback<any>): void;
70 stop(options?: {}): Promise<any>;
71
72 restart(options: {}, callback: Callback<any>): void;
73 restart(callback: Callback<any>): void;
74 restart(options?: {}): Promise<any>;
75
76 kill(options: {}, callback: Callback<any>): void;
77 kill(callback: Callback<any>): void;
78 kill(options?: {}): Promise<any>;
79
80 resize(options: {}, callback: Callback<any>): void;
81 resize(callback: Callback<any>): void;
82 resize(options?: {}): Promise<any>;
83
84 wait(callback: Callback<any>): void;
85 wait(): Promise<any>;
86
87 remove(options: {}, callback: Callback<any>): void;
88 remove(callback: Callback<any>): void;
89 remove(options?: {}): Promise<any>;
90
91 /** Deprecated since RAPI v1.20 */
92 copy(options: {}, callback: Callback<any>): void;
93 /** Deprecated since RAPI v1.20 */
94 copy(callback: Callback<any>): void;
95 /** Deprecated since RAPI v1.20 */
96 copy(options?: {}): Promise<any>;
97
98 getArchive(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
99 getArchive(options: {}): Promise<NodeJS.ReadableStream>;
100
101 infoArchive(options: {}, callback: Callback<any>): void;
102 infoArchive(options: {}): Promise<any>;
103
104 /** @param file Filename (will read synchronously), Buffer or stream */
105 putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}, callback: Callback<NodeJS.WritableStream>): void;
106 putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise<NodeJS.ReadWriteStream>;
107
108 logs(options: ContainerLogsOptions, callback: Callback<NodeJS.ReadableStream>): void;
109 logs(callback: Callback<NodeJS.ReadableStream>): void;
110 logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
111
112 stats(options: {}, callback: Callback<ContainerStats>): void;
113 stats(callback: Callback<ContainerStats>): void;
114 stats(options?: {}): Promise<ContainerStats>;
115
116 attach(options: {}, callback: Callback<NodeJS.ReadWriteStream>): void;
117 attach(options: {}): Promise<NodeJS.ReadWriteStream>;
118 }
119
120 class Image {
121 constructor(modem: any, name: string);
122
123 modem: any;
124 id: string;
125
126 inspect(callback: Callback<ImageInspectInfo>): void;
127 inspect(): Promise<ImageInspectInfo>;
128
129 history(callback: Callback<any>): void;
130 history(): Promise<any>;
131
132 get(callback: Callback<NodeJS.ReadableStream>): void;
133 get(): Promise<NodeJS.ReadableStream>;
134
135 push(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
136 push(callback: Callback<NodeJS.ReadableStream>): void;
137 push(options?: {}): Promise<NodeJS.ReadableStream>;
138
139 tag(options: {}, callback: Callback<any>): void;
140 tag(callback: Callback<any>): void;
141 tag(options?: {}): Promise<any>;
142
143 remove(options: {}, callback: Callback<ImageRemoveInfo>): void;
144 remove(callback: Callback<ImageRemoveInfo>): void;
145 remove(options?: {}): Promise<any>;
146 }
147
148 class Volume {
149 constructor(modem: any, name: string);
150
151 modem: any;
152 name: string;
153
154 inspect(callback: Callback<VolumeInspectInfo>): void;
155 inspect(): Promise<VolumeInspectInfo>;
156
157 remove(options: {}, callback: Callback<any>): void;
158 remove(callback: Callback<any>): void;
159 remove(options?: {}): Promise<any>;
160 }
161
162 class Service {
163 constructor(modem: any, id: string);
164
165 modem: any;
166 id: string;
167
168 inspect(callback: Callback<any>): void;
169 inspect(): Promise<any>;
170
171 remove(options: {}, callback: Callback<any>): void;
172 remove(callback: Callback<any>): void;
173 remove(options?: {}): Promise<any>;
174
175 update(options: {}, callback: Callback<any>): void;
176 update(options: {}): Promise<any>;
177
178 logs(options: ContainerLogsOptions, callback: Callback<NodeJS.ReadableStream>): void;
179 logs(callback: Callback<NodeJS.ReadableStream>): void;
180 logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
181 }
182
183 class Task {
184 constructor(modem: any, id: string);
185
186 modem: any;
187 id: string;
188
189 inspect(callback: Callback<any>): void;
190 inspect(): Promise<any>;
191 }
192
193 class Node {
194 constructor(modem: any, id: string);
195
196 modem: any;
197 id: string;
198
199 inspect(callback: Callback<any>): void;
200 inspect(): Promise<any>;
201
202 update(options: {}, callback: Callback<any>): void;
203 update(callback: Callback<any>): void;
204 update(options?: {}): Promise<any>;
205
206 remove(options: {}, callback: Callback<any>): void;
207 remove(callback: Callback<any>): void;
208 remove(options?: {}): Promise<any>;
209 }
210
211 class Plugin {
212 constructor(modem: any, name: string, remote?: any);
213
214 modem: any;
215 name: string;
216 remote: any;
217
218 inspect(callback: Callback<PluginInspectInfo>): void;
219 inspect(): Promise<PluginInspectInfo>;
220
221 remove(options: {}, callback: Callback<any>): void;
222 remove(callback: Callback<any>): void;
223 remove(options?: {}): Promise<any>;
224
225 privileges(callback: Callback<any>): void;
226 privileges(): Promise<any>;
227
228 pull(options: {}, callback: Callback<any>): void;
229 pull(options: {}): Promise<any>;
230
231 enable(options: {}, callback: Callback<any>): void;
232 enable(callback: Callback<any>): void;
233 enable(options?: {}): Promise<any>;
234
235 disable(options: {}, callback: Callback<any>): void;
236 disable(callback: Callback<any>): void;
237 disable(options?: {}): Promise<any>;
238
239 push(options: {}, callback: Callback<any>): void;
240 push(callback: Callback<any>): void;
241 push(options?: {}): Promise<any>;
242
243 configure(options: {}, callback: Callback<any>): void;
244 configure(callback: Callback<any>): void;
245 configure(options?: {}): Promise<any>;
246
247 upgrade(auth: any, options: {}, callback: Callback<any>): void;
248 upgrade(auth: any, callback: Callback<any>): void;
249 upgrade(auth: any, options?: {}): Promise<any>;
250 }
251
252 class Secret {
253 constructor(modem: any, id: string);
254
255 modem: any;
256 id: string;
257
258 inspect(callback: Callback<SecretInfo>): void;
259 inspect(): Promise<SecretInfo>;
260
261 update(options: {}, callback: Callback<any>): void;
262 update(callback: Callback<any>): void;
263 update(options?: {}): Promise<any>;
264
265 remove(options: {}, callback: Callback<any>): void;
266 remove(callback: Callback<any>): void;
267 remove(options?: {}): Promise<any>;
268 }
269
270 class Network {
271 constructor(modem: any, id: string);
272
273 modem: any;
274 id: string;
275
276 inspect(callback: Callback<any>): void;
277 inspect(): Promise<any>;
278
279 remove(options: {}, callback: Callback<any>): void;
280 remove(callback: Callback<any>): void;
281 remove(options?: {}): Promise<any>;
282
283 connect(options: {}, callback: Callback<any>): void;
284 connect(callback: Callback<any>): void;
285 connect(options?: {}): Promise<any>;
286
287 disconnect(options: {}, callback: Callback<any>): void;
288 disconnect(callback: Callback<any>): void;
289 disconnect(options?: {}): Promise<any>;
290 }
291
292 class Exec {
293 constructor(modem: any, id: string);
294
295 modem: any;
296 id: string;
297
298 inspect(callback: Callback<any>): void;
299 inspect(): Promise<any>;
300
301 start(options: {}, callback: Callback<any>): void;
302 start(options: {}): Promise<any>;
303
304 resize(options: {}, callback: Callback<any>): void;
305 resize(options: {}): Promise<any>;
306 }
307
308 class Config {
309 constructor(modem: any, id: string);
310
311 modem: any;
312 id: string;
313
314 inspect(callback: Callback<ConfigInfo>): void;
315 inspect(): Promise<ConfigInfo>;
316
317 update(options: {}, callback: Callback<any>): void;
318 update(callback: Callback<any>): void;
319 update(options?: {}): Promise<any>;
320
321 remove(options: {}, callback: Callback<any>): void;
322 remove(callback: Callback<any>): void;
323 remove(options?: {}): Promise<any>;
324 }
325
326 interface ImageInfo {
327 Id: string;
328 ParentId: string;
329 RepoTags: string[];
330 RepoDigests?: string[];
331 Created: number;
332 Size: number;
333 VirtualSize: number;
334 Labels: { [label: string]: string };
335 }
336
337 interface ContainerInfo {
338 Id: string;
339 Names: string[];
340 Image: string;
341 ImageID: string;
342 Command: string;
343 Created: number;
344 Ports: Port[];
345 Labels: { [label: string]: string };
346 State: string;
347 Status: string;
348 HostConfig: {
349 NetworkMode: string;
350 };
351 NetworkSettings: {
352 Networks: { [networkType: string]: NetworkInfo }
353 };
354 Mounts: Array<{
355 Name?: string;
356 Type: string;
357 Source: string;
358 Destination: string;
359 Driver?: string;
360 Mode: string;
361 RW: boolean;
362 Propagation: string;
363 }>;
364 }
365
366 interface Port {
367 IP: string;
368 PrivatePort: number;
369 PublicPort: number;
370 Type: string;
371 }
372
373 interface NetworkInfo {
374 IPAMConfig?: any;
375 Links?: any;
376 Aliases?: any;
377 NetworkID: string;
378 EndpointID: string;
379 Gateway: string;
380 IPAddress: string;
381 IPPrefixLen: number;
382 IPv6Gateway: string;
383 GlobalIPv6Address: string;
384 GlobalIPv6PrefixLen: number;
385 MacAddress: string;
386 }
387
388 // Information returned from inspecting a network
389 interface NetworkInspectInfo {
390 Name: string;
391 Id: string;
392 Created: string;
393 Scope: string;
394 Driver: string;
395 EnableIPv6: boolean;
396 IPAM?: IPAM;
397 Internal: boolean;
398 Attachable: boolean;
399 Ingress: boolean;
400 Containers?: { [id: string]: NetworkContainer };
401 Options?: { [key: string]: string };
402 Labels?: { [key: string]: string };
403 }
404
405 interface NetworkContainer {
406 Name: string;
407 EndpointID: string;
408 MacAddress: string;
409 Ipv4Address: string;
410 IPv6Address: string;
411 }
412
413 /* tslint:disable:interface-name */
414 interface IPAM {
415 Driver: string;
416 Config?: { [key: string]: string };
417 Options?: Array<{ [key: string]: string }>;
418 }
419 /* tslint:enable:interface-name */
420
421 interface VolumeInspectInfo {
422 Name: string;
423 Driver: string;
424 Mountpoint: string;
425 Status?: { [key: string]: string };
426 Labels: { [key: string]: string };
427 Scope: 'local' | 'global';
428 // Field is always present, but sometimes is null
429 Options: { [key: string]: string } | null;
430 // Field is sometimes present, and sometimes null
431 UsageData?: {
432 Size: number;
433 RefCount: number;
434 } | null;
435 }
436
437 interface ContainerInspectInfo {
438 Id: string;
439 Created: string;
440 Path: string;
441 Args: string[];
442 State: {
443 Status: string;
444 Running: boolean;
445 Paused: boolean;
446 Restarting: boolean;
447 OOMKilled: boolean;
448 Dead: boolean;
449 Pid: number;
450 ExitCode: number;
451 Error: string;
452 StartedAt: string;
453 FinishedAt: string;
454 };
455 Image: string;
456 ResolvConfPath: string;
457 HostnamePath: string;
458 HostsPath: string;
459 LogPath: string;
460 Name: string;
461 RestartCount: number;
462 Driver: string;
463 MountLabel: string;
464 ProcessLabel: string;
465 AppArmorProfile: string;
466 ExecIDs?: any;
467 HostConfig: HostConfig;
468 GraphDriver: {
469 Name: string;
470 Data: {
471 DeviceId: string;
472 DeviceName: string;
473 DeviceSize: string;
474 }
475 };
476 Mounts: Array<{
477 Name?: string;
478 Source: string;
479 Destination: string;
480 Mode: string;
481 RW: boolean;
482 Propagation: string;
483 }>;
484 Config: {
485 Hostname: string;
486 Domainname: string;
487 User: string;
488 AttachStdin: boolean;
489 AttachStdout: boolean;
490 AttachStderr: boolean;
491 ExposedPorts: { [portAndProtocol: string]: {} };
492 Tty: boolean;
493 OpenStdin: boolean;
494 StdinOnce: boolean;
495 Env: string[];
496 Cmd: string[];
497 Image: string;
498 Volumes: { [volume: string]: {} };
499 WorkingDir: string;
500 Entrypoint?: string | string[];
501 OnBuild?: any;
502 Labels: { [label: string]: string }
503 };
504 NetworkSettings: {
505 Bridge: string;
506 SandboxID: string;
507 HairpinMode: boolean;
508 LinkLocalIPv6Address: string;
509 LinkLocalIPv6PrefixLen: number;
510 Ports: {
511 [portAndProtocol: string]: Array<{
512 HostIp: string;
513 HostPort: string;
514 }>;
515 };
516 SandboxKey: string;
517 SecondaryIPAddresses?: any;
518 SecondaryIPv6Addresses?: any;
519 EndpointID: string;
520 Gateway: string;
521 GlobalIPv6Address: string;
522 GlobalIPv6PrefixLen: number;
523 IPAddress: string;
524 IPPrefixLen: number;
525 IPv6Gateway: string;
526 MacAddress: string;
527 Networks: {
528 [type: string]: {
529 IPAMConfig?: any;
530 Links?: any;
531 Aliases?: any;
532 NetworkID: string;
533 EndpointID: string;
534 Gateway: string;
535 IPAddress: string;
536 IPPrefixLen: number;
537 IPv6Gateway: string;
538 GlobalIPv6Address: string;
539 GlobalIPv6PrefixLen: number;
540 MacAddress: string;
541 };
542 };
543 Node?: {
544 ID: string;
545 IP: string;
546 Addr: string;
547 Name: string;
548 Cpus: number;
549 Memory: number;
550 Labels: any;
551 };
552 };
553 }
554
555 interface NetworkStats {
556 [name: string]: {
557 rx_bytes: number;
558 rx_dropped: number;
559 rx_errors: number;
560 rx_packets: number;
561 tx_bytes: number;
562 tx_dropped: number;
563 tx_errors: number;
564 tx_packets: number;
565 };
566 }
567
568 interface CPUStats {
569 cpu_usage: {
570 percpu_usage: number[];
571 usage_in_usermode: number;
572 total_usage: number;
573 usage_in_kernelmode: number;
574 };
575 system_cpu_usage: number;
576 online_cpus: number;
577 throttling_data: {
578 periods: number;
579 throttled_periods: number;
580 throttled_time: number;
581 };
582 }
583
584 interface MemoryStats {
585 stats: {
586 total_pgmajfault: number;
587 cache: number;
588 mapped_file: number;
589 total_inactive_file: number;
590 pgpgout: number;
591 rss: number;
592 total_mapped_file: number;
593 writeback: number;
594 unevictable: number;
595 pgpgin: number;
596 total_unevictable: number;
597 pgmajfault: number;
598 total_rss: number;
599 total_rss_huge: number;
600 total_writeback: number;
601 total_inactive_anon: number;
602 rss_huge: number;
603 hierarchical_memory_limit: number;
604 total_pgfault: number;
605 total_active_file: number;
606 active_anon: number;
607 total_active_anon: number;
608 total_pgpgout: number;
609 total_cache: number;
610 inactive_anon: number;
611 active_file: number;
612 pgfault: number;
613 inactive_file: number;
614 total_pgpgin: number;
615 };
616 max_usage: number;
617 usage: number;
618 failcnt: number;
619 limit: number;
620 }
621
622 interface ContainerStats {
623 read: string;
624 pid_stats: {
625 current: number;
626 };
627 networks: NetworkStats;
628 memory_stats: MemoryStats;
629 blkio_stats: {};
630 cpu_stats: CPUStats;
631 precpu_stats: CPUStats;
632 }
633
634 interface HostConfig {
635 AutoRemove?: boolean;
636 Binds?: string[];
637 ContainerIDFile?: string;
638 LogConfig?: {
639 Type: string;
640 Config: any;
641 };
642 NetworkMode?: string;
643 PortBindings?: any;
644 RestartPolicy?: RestartPolicy;
645 VolumeDriver?: string;
646 VolumesFrom?: any;
647 Mounts?: MountConfig;
648 CapAdd?: any;
649 CapDrop?: any;
650 Dns?: any[];
651 DnsOptions?: any[];
652 DnsSearch?: any[];
653 ExtraHosts?: any;
654 GroupAdd?: string[];
655 IpcMode?: string;
656 Cgroup?: string;
657 Links?: any;
658 OomScoreAdj?: number;
659 PidMode?: string;
660 Privileged?: boolean;
661 PublishAllPorts?: boolean;
662 ReadonlyRootfs?: boolean;
663 SecurityOpt?: any;
664 StorageOpt?: { [option: string]: string };
665 Tmpfs?: { [dir: string]: string };
666 UTSMode?: string;
667 UsernsMode?: string;
668 ShmSize?: number;
669 Sysctls?: { [index: string]: string };
670 Runtime?: string;
671 ConsoleSize?: number[];
672 Isolation?: string;
673 MaskedPaths?: string[];
674 ReadonlyPaths?: string[];
675 CpuShares?: number;
676 CgroupParent?: string;
677 BlkioWeight?: number;
678 BlkioWeightDevice?: any;
679 BlkioDeviceReadBps?: any;
680 BlkioDeviceWriteBps?: any;
681 BlkioDeviceReadIOps?: any;
682 BlkioDeviceWriteIOps?: any;
683 CpuPeriod?: number;
684 CpuQuota?: number;
685 CpusetCpus?: string;
686 CpusetMems?: string;
687 Devices?: any;
688 DiskQuota?: number;
689 KernelMemory?: number;
690 Memory?: number;
691 MemoryReservation?: number;
692 MemorySwap?: number;
693 MemorySwappiness?: number;
694 OomKillDisable?: boolean;
695 PidsLimit?: number;
696 Ulimits?: any;
697 }
698
699 interface ImageInspectInfo {
700 Id: string;
701 RepoTags: string[];
702 RepoDigests: string[];
703 Parent: string;
704 Comment: string;
705 Created: string;
706 Container: string;
707 ContainerConfig:
708 {
709 Hostname: string;
710 Domainname: string;
711 User: string;
712 AttachStdin: boolean;
713 AttachStdout: boolean;
714 AttachStderr: boolean;
715 ExposedPorts: { [portAndProtocol: string]: {} };
716 Tty: boolean;
717 OpenStdin: boolean;
718 StdinOnce: boolean;
719 Env: string[];
720 Cmd: string[];
721 ArgsEscaped: boolean;
722 Image: string;
723 Volumes: { [path: string]: {} },
724 WorkingDir: string;
725 Entrypoint?: string | string[];
726 OnBuild?: any[];
727 Labels: { [label: string]: string }
728 };
729 DockerVersion: string;
730 Author: string;
731 Config:
732 {
733 Hostname: string;
734 Domainname: string;
735 User: string;
736 AttachStdin: boolean;
737 AttachStdout: boolean;
738 AttachStderr: boolean;
739 ExposedPorts: { [portAndProtocol: string]: {} }
740 Tty: boolean;
741 OpenStdin: boolean;
742 StdinOnce: boolean;
743 Env: string[];
744 Cmd: string[];
745 ArgsEscaped: boolean;
746 Image: string;
747 Volumes: { [path: string]: {} },
748 WorkingDir: string;
749 Entrypoint?: string | string[];
750 OnBuild: any[];
751 Labels: { [label: string]: string }
752 };
753 Architecture: string;
754 Os: string;
755 Size: number;
756 VirtualSize: number;
757 GraphDriver:
758 {
759 Name: string;
760 Data:
761 {
762 DeviceId: string;
763 DeviceName: string;
764 DeviceSize: string;
765 }
766 };
767 RootFS: {
768 Type: string;
769 Layers?: string[];
770 BaseLayer?: string;
771 };
772 }
773
774 interface AuthConfig {
775 username: string;
776 password: string;
777 serveraddress: string;
778 email?: string;
779 }
780
781 interface PortBinding {
782 HostIp?: string;
783 HostPort?: string;
784 }
785
786 interface PortMap {
787 [key: string]: PortBinding[];
788 }
789
790 interface RestartPolicy {
791 Name: string;
792 MaximumRetryCount?: number;
793 }
794
795 type LoggingDriverType =
796 | "json-file"
797 | "syslog"
798 | "journald"
799 | "gelf"
800 | "fluentd"
801 | "awslogs"
802 | "splunk"
803 | "etwlogs"
804 | "none";
805
806 interface LogConfig {
807 Type: LoggingDriverType;
808 Config?: { [key: string]: string };
809 }
810
811 interface DeviceMapping {
812 PathOnHost: string;
813 PathInContainer: string;
814 CgroupPermissions: string;
815 }
816
817 /* tslint:disable:interface-name */
818 interface IPAMConfig {
819 IPv4Address?: string;
820 IPv6Address?: string;
821 LinkLocalIPs?: string[];
822 }
823 /* tslint:enable:interface-name */
824
825 interface EndpointSettings {
826 IPAMConfig?: IPAMConfig;
827 Links?: string[];
828 Aliases?: string[];
829 NetworkID?: string;
830 EndpointID?: string;
831 Gateway?: string;
832 IPAddress?: string;
833 IPPrefixLen?: number;
834 IPv6Gateway?: string;
835 GlobalIPv6Address?: string;
836 GlobalIPV6PrefixLen?: number;
837 MacAddress?: string;
838 DriverOpts?: { [key: string]: string };
839 }
840
841 interface EndpointsConfig {
842 [key: string]: EndpointSettings;
843 }
844
845 type MountType =
846 | "bind"
847 | "volume"
848 | "tmpfs";
849
850 type MountConsistency =
851 | "default"
852 | "consistent"
853 | "cached"
854 | "delegated";
855
856 type MountPropagation =
857 | "private"
858 | "rprivate"
859 | "shared"
860 | "rshared"
861 | "slave"
862 | "rslave";
863
864 interface MountSettings {
865 Target: string;
866 Source: string;
867 Type: MountType;
868 ReadOnly ?: boolean;
869 Consistency ?: MountConsistency;
870 BindOptions ?: {
871 Propagation: MountPropagation;
872 };
873 VolumeOptions ?: {
874 NoCopy: boolean;
875 Labels: { [label: string]: string };
876 DriverConfig: {
877 Name: string;
878 Options: { [option: string]: string};
879 };
880 };
881 TmpfsOptions ?: {
882 SizeBytes: number;
883 Mode: number;
884 };
885 }
886
887 type MountConfig = MountSettings[];
888
889 interface ContainerCreateOptions {
890 name?: string;
891 Hostname?: string;
892 Domainname?: string;
893 User?: string;
894 AttachStdin?: boolean;
895 AttachStdout?: boolean;
896 AttachStderr?: boolean;
897 Tty?: boolean;
898 OpenStdin?: boolean;
899 StdinOnce?: boolean;
900 Env?: string[];
901 Cmd?: string[];
902 Entrypoint?: string | string[];
903 Image?: string;
904 Labels?: { [label: string]: string };
905 Volumes?: { [volume: string]: {} };
906 WorkingDir?: string;
907 NetworkDisabled?: boolean;
908 MacAddress?: boolean;
909 ExposedPorts?: { [port: string]: {} };
910 StopSignal?: string;
911 StopTimeout?: number;
912 HostConfig?: HostConfig;
913 NetworkingConfig?: {
914 EndpointsConfig?: EndpointsConfig;
915 };
916 }
917
918 interface KeyObject {
919 pem: string | Buffer;
920 passphrase?: string;
921 }
922
923 interface DockerOptions {
924 socketPath?: string;
925 host?: string;
926 port?: number | string;
927 ca?: string | string[] | Buffer | Buffer[];
928 cert?: string | string[] | Buffer | Buffer[];
929 key?: string | string[] | Buffer | Buffer[] | KeyObject[];
930 protocol?: "https" | "http";
931 timeout?: number;
932 version?: string;
933 Promise?: typeof Promise;
934 }
935
936 interface GetEventsOptions {
937 since?: number;
938 until?: number;
939 filters?: string;
940 }
941
942 interface SecretVersion {
943 Index: number;
944 }
945
946 interface ServiceSpec {
947 Name: string;
948 }
949
950 interface SecretInfo {
951 ID: string;
952 Version: SecretVersion;
953 CreatedAt: string;
954 UpdatedAt?: string;
955 Spec?: ServiceSpec;
956 }
957
958 interface ConfigInfo {
959 ID: string;
960 Version: SecretVersion;
961 CreatedAt: string;
962 UpdatedAt?: string;
963 Spec?: ConfigSpec;
964 }
965
966 interface ConfigSpec {
967 Name: string;
968 Labels: { [label: string]: string };
969 Data: string;
970 }
971
972 interface ConfigVersion {
973 Index: number;
974 }
975
976 interface PluginInfo {
977 Id?: string;
978 Name: string;
979 Enabled: boolean;
980 Settings: PluginSettings;
981 PluginReference?: string;
982 Config: PluginConfig;
983 }
984
985 type PluginInspectInfo = PluginInfo;
986
987 interface PluginSettings {
988 Mounts: PluginMount[];
989 Env: string[];
990 Args: string[];
991 Devices: PluginDevice[];
992 }
993
994 interface PluginConfig {
995 Description: string;
996 Documentation: string;
997 Interface: any;
998 Entrypoint: string[];
999 WorkDir: string;
1000 User?: User;
1001 Network: Network;
1002 Linux: Linux;
1003 PropagatedMount: string;
1004 Mounts: PluginMount[];
1005 Env: PluginEnv[];
1006 Args: Args;
1007 rootfs: any;
1008 }
1009
1010 interface Interface {
1011 Types: PluginInterfaceType[];
1012 Socket: string;
1013 }
1014
1015 interface PluginInterfaceType {
1016 Prefix: string;
1017 Capability: string;
1018 Version: string;
1019 }
1020
1021 interface PluginMount {
1022 Name: string;
1023 Description: string;
1024 Settable: string[];
1025 Source: string;
1026 Destination: string;
1027 Type: string;
1028 Options: string[];
1029 }
1030
1031 interface Linux {
1032 Capabilities: string[];
1033 AllowAllDevices: boolean;
1034 Devices: PluginDevice[];
1035 }
1036
1037 interface PluginDevice {
1038 Name: string;
1039 Description: string;
1040 Settable: string[];
1041 Path: string;
1042 }
1043
1044 interface Network {
1045 Type: string;
1046 }
1047
1048 interface PluginEnv {
1049 Name: string;
1050 Description: string;
1051 Settable: string[];
1052 Value: string;
1053 }
1054
1055 interface Args {
1056 Name: string;
1057 Description: string;
1058 Settable: string[];
1059 Value: string;
1060 }
1061
1062 interface User {
1063 UID: number;
1064 GID: number;
1065 }
1066
1067 interface ImageRemoveInfo {
1068 Untagged: string;
1069 Deleted: string;
1070 }
1071
1072 interface PruneImagesInfo {
1073 ImagesDeleted: ImageRemoveInfo[];
1074 SpaceReclaimed: number;
1075 }
1076
1077 interface PruneVolumesInfo {
1078 VolumesDeleted: string[];
1079 SpaceReclaimed: number;
1080 }
1081
1082 interface PruneContainersInfo {
1083 ContainersDeleted: string[];
1084 SpaceReclaimed: number;
1085 }
1086
1087 interface PruneNetworksInfo {
1088 NetworksDeleted: string[];
1089 }
1090
1091 interface ContainerLogsOptions {
1092 stdout?: boolean;
1093 stderr?: boolean;
1094 follow?: boolean;
1095 since?: number;
1096 details?: boolean;
1097 tail?: number;
1098 timestamps?: boolean;
1099 }
1100
1101 interface ImageBuildContext {
1102 context: string;
1103 src: string[];
1104 }
1105
1106 interface DockerVersion {
1107 ApiVersion: string;
1108 Arch: string;
1109 BuildTime: Date;
1110 Components: Array<{
1111 Details: {
1112 ApiVersion: string;
1113 Arch: string;
1114 BuildTime: Date;
1115 Experimental: string;
1116 GitCommit: string;
1117 GoVersion: string;
1118 KernelVersion: string;
1119 Os: string;
1120 };
1121 Name: string;
1122 Version: string;
1123 }>;
1124 GitCommit: string;
1125 GoVersion: string;
1126 KernelVersion: string;
1127 MinAPIVersion: string;
1128 Os: string;
1129 Platform: {
1130 Name: string;
1131 };
1132 Version: string;
1133 }
1134}
1135
1136type Callback<T> = (error?: any, result?: T) => void;
1137
1138declare class Dockerode {
1139 constructor(options?: Dockerode.DockerOptions);
1140
1141 createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback<Dockerode.Container>): void;
1142 createContainer(options: Dockerode.ContainerCreateOptions): Promise<Dockerode.Container>;
1143
1144 createImage(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1145 createImage(auth: any, options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1146 createImage(options: {}): Promise<NodeJS.ReadableStream>;
1147 createImage(auth: any, options: {}): Promise<NodeJS.ReadableStream>;
1148
1149 loadImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1150 loadImage(file: string | NodeJS.ReadableStream, callback: Callback<NodeJS.ReadableStream>): void;
1151 loadImage(file: string | NodeJS.ReadableStream, options?: {}): Promise<NodeJS.ReadableStream>;
1152
1153 importImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1154 importImage(file: string | NodeJS.ReadableStream, callback: Callback<NodeJS.ReadableStream>): void;
1155 importImage(file: string | NodeJS.ReadableStream, options?: {}): Promise<NodeJS.ReadableStream>;
1156
1157 checkAuth(options: any, callback: Callback<any>): void;
1158 checkAuth(options: any): Promise<any>;
1159
1160 buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options: {}, callback: Callback<NodeJS.ReadableStream>): void;
1161 buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, callback: Callback<NodeJS.ReadableStream>): void;
1162 buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options?: {}): Promise<NodeJS.ReadableStream>;
1163
1164 getContainer(id: string): Dockerode.Container;
1165
1166 getImage(name: string): Dockerode.Image;
1167
1168 getVolume(name: string): Dockerode.Volume;
1169
1170 getPlugin(name: string, remote: any): Dockerode.Plugin;
1171
1172 getService(id: string): Dockerode.Service;
1173
1174 getTask(id: string): Dockerode.Task;
1175
1176 getNode(id: string): Dockerode.Node;
1177
1178 getNetwork(id: string): Dockerode.Network;
1179
1180 getSecret(id: string): Dockerode.Secret;
1181
1182 getExec(id: string): Dockerode.Exec;
1183
1184 getConfig(id: string): Dockerode.Config;
1185
1186 listContainers(options: {}, callback: Callback<Dockerode.ContainerInfo[]>): void;
1187 listContainers(callback: Callback<Dockerode.ContainerInfo[]>): void;
1188 listContainers(options?: {}): Promise<Dockerode.ContainerInfo[]>;
1189
1190 listImages(options: {}, callback: Callback<Dockerode.ImageInfo[]>): void;
1191 listImages(callback: Callback<Dockerode.ImageInfo[]>): void;
1192 listImages(options?: {}): Promise<Dockerode.ImageInfo[]>;
1193
1194 listServices(options: {}, callback: Callback<any[]>): void;
1195 listServices(callback: Callback<any[]>): void;
1196 listServices(options?: {}): Promise<any[]>;
1197
1198 listNodes(options: {}, callback: Callback<any[]>): void;
1199 listNodes(callback: Callback<any[]>): void;
1200 listNodes(options?: {}): Promise<any[]>;
1201
1202 listTasks(options: {}, callback: Callback<any[]>): void;
1203 listTasks(callback: Callback<any[]>): void;
1204 listTasks(options?: {}): Promise<any[]>;
1205
1206 listSecrets(options: {}, callback: Callback<Dockerode.SecretInfo[]>): void;
1207 listSecrets(callback: Callback<Dockerode.SecretInfo[]>): void;
1208 listSecrets(options?: {}): Promise<Dockerode.SecretInfo[]>;
1209
1210 listPlugins(options: {}, callback: Callback<Dockerode.PluginInfo[]>): void;
1211 listPlugins(callback: Callback<Dockerode.PluginInfo[]>): void;
1212 listPlugins(options?: {}): Promise<Dockerode.PluginInfo[]>;
1213
1214 listVolumes(options: {}, callback: Callback<{
1215 Volumes: Dockerode.VolumeInspectInfo[];
1216 Warnings: string[];
1217 }>): void;
1218 listVolumes(callback: Callback<{
1219 Volumes: Dockerode.VolumeInspectInfo[];
1220 Warnings: string[];
1221 }>): void;
1222 listVolumes(options?: {}): Promise<{
1223 Volumes: Dockerode.VolumeInspectInfo[];
1224 Warnings: string[];
1225 }>;
1226
1227 listNetworks(options: {}, callback: Callback<any[]>): void;
1228 listNetworks(callback: Callback<any[]>): void;
1229 listNetworks(options?: {}): Promise<any[]>;
1230
1231 listConfigs(options: {}, callback: Callback<Dockerode.ConfigInfo[]>): void;
1232 listConfigs(callback: Callback<Dockerode.ConfigInfo[]>): void;
1233 listConfigs(options?: {}): Promise<Dockerode.ConfigInfo[]>;
1234
1235 createSecret(options: {}, callback: Callback<any>): void;
1236 createSecret(options: {}): Promise<any>;
1237
1238 createConfig(options: {}, callback: Callback<any>): void;
1239 createConfig(options: {}): Promise<any>;
1240
1241 createPlugin(options: {}, callback: Callback<any>): void;
1242 createPlugin(options: {}): Promise<any>;
1243
1244 createVolume(options: {}, callback: Callback<any>): void;
1245 createVolume(options: {}): Promise<any>;
1246
1247 createService(options: {}, callback: Callback<any>): void;
1248 createService(options: {}): Promise<any>;
1249
1250 createNetwork(options: {}, callback: Callback<any>): void;
1251 createNetwork(options: {}): Promise<any>;
1252
1253 searchImages(options: {}, callback: Callback<any>): void;
1254 searchImages(options: {}): Promise<any>;
1255
1256 pruneImages(options: {}, callback: Callback<Dockerode.PruneImagesInfo>): void;
1257 pruneImages(callback: Callback<Dockerode.PruneImagesInfo>): void;
1258 pruneImages(options?: {}): Promise<Dockerode.PruneImagesInfo>;
1259
1260 pruneContainers(options: {}, callback: Callback<Dockerode.PruneContainersInfo>): void;
1261 pruneContainers(callback: Callback<Dockerode.PruneContainersInfo>): void;
1262 pruneContainers(options?: {}): Promise<Dockerode.PruneContainersInfo>;
1263
1264 pruneVolumes(options: {}, callback: Callback<Dockerode.PruneVolumesInfo>): void;
1265 pruneVolumes(callback: Callback<Dockerode.PruneVolumesInfo>): void;
1266 pruneVolumes(options?: {}): Promise<Dockerode.PruneVolumesInfo>;
1267
1268 pruneNetworks(options: {}, callback: Callback<Dockerode.PruneNetworksInfo>): void;
1269 pruneNetworks(callback: Callback<Dockerode.PruneNetworksInfo>): void;
1270 pruneNetworks(options?: {}): Promise<Dockerode.PruneNetworksInfo>;
1271
1272 info(callback: Callback<any>): void;
1273 info(): Promise<any>;
1274
1275 df(callback: Callback<any>): void;
1276 df(): Promise<any>;
1277
1278 version(callback: Callback<Dockerode.DockerVersion>): void;
1279 version(): Promise<Dockerode.DockerVersion>;
1280
1281 ping(callback: Callback<any>): void;
1282 ping(): Promise<any>;
1283
1284 getEvents(options: Dockerode.GetEventsOptions, callback: Callback<NodeJS.ReadableStream>): void;
1285 getEvents(callback: Callback<NodeJS.ReadableStream>): void;
1286 getEvents(options?: Dockerode.GetEventsOptions): Promise<NodeJS.ReadableStream>;
1287
1288 pull(repoTag: string, options: {}, callback: Callback<any>, auth?: {}): Dockerode.Image;
1289 pull(repoTag: string, options: {}, auth?: {}): Promise<any>;
1290
1291 run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions: {}, startOptions: {}, callback: Callback<any>): events.EventEmitter;
1292 run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], startOptions: {}, callback: Callback<any>): events.EventEmitter;
1293 run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], callback: Callback<any>): events.EventEmitter;
1294 run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions: {}, callback: Callback<any>): events.EventEmitter;
1295 run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions?: {}, startOptions?: {}): Promise<any>;
1296
1297 swarmInit(options: {}, callback: Callback<any>): void;
1298 swarmInit(options: {}): Promise<any>;
1299
1300 swarmJoin(options: {}, callback: Callback<any>): void;
1301 swarmJoin(options: {}): Promise<any>;
1302
1303 swarmLeave(options: {}, callback: Callback<any>): void;
1304 swarmLeave(options: {}): Promise<any>;
1305
1306 swarmUpdate(options: {}, callback: Callback<any>): void;
1307 swarmUpdate(options: {}): Promise<any>;
1308
1309 swarmInspect(callback: Callback<any>): void;
1310 swarmInspect(): Promise<any>;
1311
1312 modem: any;
1313}
1314
1315export = Dockerode;