From f614dfc4cece097abee05ae8e6f00fb510fb3274 Mon Sep 17 00:00:00 2001 From: Page- Date: Mon, 23 Mar 2020 19:20:31 +0000 Subject: [PATCH] dockerode: Improve GetEventsOptions to allow passing a filter object (#43100) * dockerode: apply prettier * dockerode: improve GetEventsOptions to allow passing a filter object --- types/dockerode/dockerode-tests.ts | 178 ++- types/dockerode/index.d.ts | 2314 ++++++++++++++-------------- 2 files changed, 1280 insertions(+), 1212 deletions(-) diff --git a/types/dockerode/dockerode-tests.ts b/types/dockerode/dockerode-tests.ts index ac48206943..7e55b160db 100644 --- a/types/dockerode/dockerode-tests.ts +++ b/types/dockerode/dockerode-tests.ts @@ -9,213 +9,221 @@ const docker3 = new Docker({ protocol: 'http', host: '127.0.0.1', port: 3000 }); const docker4 = new Docker({ host: '127.0.0.1', port: 3000 }); const docker5 = new Docker({ - host: '192.168.1.10', - port: process.env.DOCKER_PORT || 2375, - ca: 'ca', - cert: 'cert', - key: 'key' + host: '192.168.1.10', + port: process.env.DOCKER_PORT || 2375, + ca: 'ca', + cert: 'cert', + key: 'key', }); const docker6 = new Docker({ - protocol: 'https', // you can enforce a protocol - host: '192.168.1.10', - port: process.env.DOCKER_PORT || 2375, - ca: 'ca', - cert: 'cert', - key: 'key' + protocol: 'https', // you can enforce a protocol + host: '192.168.1.10', + port: process.env.DOCKER_PORT || 2375, + ca: 'ca', + cert: 'cert', + key: 'key', }); const docker7 = new Docker({ - host: '192.168.1.10', - port: process.env.DOCKER_PORT || 2375, - ca: fs.readFileSync('ca.pem'), - cert: fs.readFileSync('cert.pem'), - key: fs.readFileSync('key.pem'), - version: 'v1.25' // required when Docker >= v1.13, https://docs.docker.com/engine/api/version-history/ + host: '192.168.1.10', + port: process.env.DOCKER_PORT || 2375, + ca: fs.readFileSync('ca.pem'), + cert: fs.readFileSync('cert.pem'), + key: fs.readFileSync('key.pem'), + version: 'v1.25', // required when Docker >= v1.13, https://docs.docker.com/engine/api/version-history/ }); const docker8 = new Docker({ - protocol: 'https', // you can enforce a protocol - host: '192.168.1.10', - port: process.env.DOCKER_PORT || 2375, - ca: fs.readFileSync('ca.pem'), - cert: fs.readFileSync('cert.pem'), - key: fs.readFileSync('key.pem') + protocol: 'https', // you can enforce a protocol + host: '192.168.1.10', + port: process.env.DOCKER_PORT || 2375, + ca: fs.readFileSync('ca.pem'), + cert: fs.readFileSync('cert.pem'), + key: fs.readFileSync('key.pem'), }); const docker9 = new Docker({ - Promise + Promise, }); async function foo() { - const containers = await docker7.listContainers(); - for (const container of containers) { - const foo = await docker7.getContainer(container.Id); - const inspect = await foo.inspect(); - } + const containers = await docker7.listContainers(); + for (const container of containers) { + const foo = await docker7.getContainer(container.Id); + const inspect = await foo.inspect(); + } - const images = await docker5.listImages(); - for (const image of images) { - const foo = await docker5.getImage(image.Id); - const inspect = await foo.inspect(); - await foo.remove(); - } + const images = await docker5.listImages(); + for (const image of images) { + const foo = await docker5.getImage(image.Id); + const inspect = await foo.inspect(); + await foo.remove(); + } } docker.getEvents( - { - since: new Date().getTime() / 1000, - filters: `{ "event": ["pull"] }`, - }, - (err, stream) => { - // NOOP - }, + { + since: new Date().getTime() / 1000, + filters: `{ "event": ["pull"] }`, + }, + (err, stream) => { + // NOOP + }, +); + +docker.getEvents( + { + since: new Date().getTime() / 1000, + filters: { event: ['pull'] }, + }, + (err, stream) => { + // NOOP + }, ); docker.getEvents((err, stream) => { - // NOOP + // NOOP }); docker.getEvents().then(stream => { - // NOOP + // NOOP }); const container = docker.getContainer('container-id'); container.inspect((err, data) => { - // NOOP + // NOOP }); container.start((err, data) => { - // NOOP + // NOOP }); container.remove((err, data) => { - // NOOP + // NOOP }); docker.listContainers((err, containers) => { - containers.forEach(container => { - docker - .getContainer(container.Id) - .stop((err, data) => { - // NOOP - }); - }); + containers.forEach(container => { + docker.getContainer(container.Id).stop((err, data) => { + // NOOP + }); + }); }); docker.listContainers().then(containers => { - return containers.map(container => docker.getContainer(container.Id)); + return containers.map(container => docker.getContainer(container.Id)); }); docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => { - // NOOP + // NOOP }); -docker.buildImage({context: '.', src: ['Dockerfile', 'test.sh']}, { t: 'imageName' }, (err, response) => { - // NOOP +docker.buildImage({ context: '.', src: ['Dockerfile', 'test.sh'] }, { t: 'imageName' }, (err, response) => { + // NOOP }); docker.createContainer({ Tty: true }, (err, container) => { - container.start((err, data) => { - // NOOP - }); + container.start((err, data) => { + // NOOP + }); }); docker.pruneContainers((err, response) => { - // NOOP + // NOOP }); docker.pruneImages((err, response) => { - // NOOP + // NOOP }); docker.pruneNetworks((err, response) => { - // NOOP + // NOOP }); docker.pruneVolumes((err, response) => { - // NOOP + // NOOP }); const plugin = docker.getPlugin('pluginName', 'remoteName'); plugin.configure((err, response) => { - // NOOP; + // NOOP; }); plugin.disable((err, response) => { - // NOOP + // NOOP }); plugin.enable((err, response) => { - // NOOP + // NOOP }); plugin.inspect((err, response) => { - // NOOP + // NOOP }); plugin.privileges((err, response) => { - // NOOP + // NOOP }); plugin.pull({}, (err, response) => { - // NOOP + // NOOP }); plugin.push((err, response) => { - // NOOP + // NOOP }); plugin.remove((err, response) => { - // NOOP + // NOOP }); plugin.upgrade({}, (err, response) => { - // NOOP + // NOOP }); const secret = docker.getSecret('secretName'); secret.inspect((err, response) => { - // NOOP + // NOOP }); secret.remove((err, response) => { - // NOOP + // NOOP }); secret.update((err, response) => { - // NOOP + // NOOP }); const node = docker.getNode('nodeName'); node.inspect((err, reponse) => { - // NOOP + // NOOP }); node.inspect().then(response => { - // NOOP + // NOOP }); node.update({}, (err, response) => { - // NOOP + // NOOP }); node.update((err, response) => { - // NOOP + // NOOP }); node.update({}).then(response => { - // NOOP; + // NOOP; }); node.remove({}, (err, response) => { - // NOOP + // NOOP }); node.remove((err, response) => { - // NOOP + // NOOP }); node.remove({}).then(response => { - // NOOP; + // NOOP; }); diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 0b29e29f89..9b04e04c94 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -21,1316 +21,1376 @@ import * as events from 'events'; // https://github.com/apocas/docker-modem declare namespace Dockerode { - class Container { - constructor(modem: any, id: string); + class Container { + constructor(modem: any, id: string); - modem: any; - id: string; + modem: any; + id: string; - inspect(options: {}, callback: Callback): void; - inspect(callback: Callback): void; - inspect(options?: {}): Promise; + inspect(options: {}, callback: Callback): void; + inspect(callback: Callback): void; + inspect(options?: {}): Promise; - rename(options: {}, callback: Callback): void; - rename(options: {}): Promise; + rename(options: {}, callback: Callback): void; + rename(options: {}): Promise; - update(options: {}, callback: Callback): void; - update(options: {}): Promise; + update(options: {}, callback: Callback): void; + update(options: {}): Promise; - top(options: {}, callback: Callback): void; - top(callback: Callback): void; - top(options?: {}): Promise; + top(options: {}, callback: Callback): void; + top(callback: Callback): void; + top(options?: {}): Promise; - changes(callback: Callback): void; - changes(): Promise; + changes(callback: Callback): void; + changes(): Promise; - export(callback: Callback): void; - export(): Promise; + export(callback: Callback): void; + export(): Promise; - start(options: {}, callback: Callback): void; - start(callback: Callback): void; - start(options?: {}): Promise; + start(options: {}, callback: Callback): void; + start(callback: Callback): void; + start(options?: {}): Promise; - pause(options: {}, callback: Callback): void; - pause(callback: Callback): void; - pause(options?: {}): Promise; + pause(options: {}, callback: Callback): void; + pause(callback: Callback): void; + pause(options?: {}): Promise; - unpause(options: {}, callback: Callback): void; - unpause(callback: Callback): void; - unpause(options?: {}): Promise; + unpause(options: {}, callback: Callback): void; + unpause(callback: Callback): void; + unpause(options?: {}): Promise; - exec(options: {}, callback: Callback): void; - exec(options: {}): Promise; + exec(options: {}, callback: Callback): void; + exec(options: {}): Promise; - commit(options: {}, callback: Callback): void; - commit(callback: Callback): void; - commit(options?: {}): Promise; + commit(options: {}, callback: Callback): void; + commit(callback: Callback): void; + commit(options?: {}): Promise; - stop(options: {}, callback: Callback): void; - stop(callback: Callback): void; - stop(options?: {}): Promise; + stop(options: {}, callback: Callback): void; + stop(callback: Callback): void; + stop(options?: {}): Promise; - restart(options: {}, callback: Callback): void; - restart(callback: Callback): void; - restart(options?: {}): Promise; + restart(options: {}, callback: Callback): void; + restart(callback: Callback): void; + restart(options?: {}): Promise; - kill(options: {}, callback: Callback): void; - kill(callback: Callback): void; - kill(options?: {}): Promise; + kill(options: {}, callback: Callback): void; + kill(callback: Callback): void; + kill(options?: {}): Promise; - resize(options: {}, callback: Callback): void; - resize(callback: Callback): void; - resize(options?: {}): Promise; + resize(options: {}, callback: Callback): void; + resize(callback: Callback): void; + resize(options?: {}): Promise; - wait(callback: Callback): void; - wait(): Promise; + wait(callback: Callback): void; + wait(): Promise; - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; - /** Deprecated since RAPI v1.20 */ - copy(options: {}, callback: Callback): void; - /** Deprecated since RAPI v1.20 */ - copy(callback: Callback): void; - /** Deprecated since RAPI v1.20 */ - copy(options?: {}): Promise; + /** Deprecated since RAPI v1.20 */ + copy(options: {}, callback: Callback): void; + /** Deprecated since RAPI v1.20 */ + copy(callback: Callback): void; + /** Deprecated since RAPI v1.20 */ + copy(options?: {}): Promise; - getArchive(options: {}, callback: Callback): void; - getArchive(options: {}): Promise; + getArchive(options: {}, callback: Callback): void; + getArchive(options: {}): Promise; - infoArchive(options: {}, callback: Callback): void; - infoArchive(options: {}): Promise; + infoArchive(options: {}, callback: Callback): void; + infoArchive(options: {}): Promise; - /** @param file Filename (will read synchronously), Buffer or stream */ - putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}, callback: Callback): void; - putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise; + /** @param file Filename (will read synchronously), Buffer or stream */ + putArchive( + file: string | Buffer | NodeJS.ReadableStream, + options: {}, + callback: Callback, + ): void; + putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise; - logs(options: ContainerLogsOptions, callback: Callback): void; - logs(callback: Callback): void; - logs(options?: ContainerLogsOptions): Promise; + logs(options: ContainerLogsOptions, callback: Callback): void; + logs(callback: Callback): void; + logs(options?: ContainerLogsOptions): Promise; - stats(options: {}, callback: Callback): void; - stats(callback: Callback): void; - stats(options?: {}): Promise; + stats(options: {}, callback: Callback): void; + stats(callback: Callback): void; + stats(options?: {}): Promise; - attach(options: {}, callback: Callback): void; - attach(options: {}): Promise; - } + attach(options: {}, callback: Callback): void; + attach(options: {}): Promise; + } - class Image { - constructor(modem: any, name: string); + class Image { + constructor(modem: any, name: string); - modem: any; - id: string; + modem: any; + id: string; - inspect(callback: Callback): void; - inspect(): Promise; + inspect(callback: Callback): void; + inspect(): Promise; - history(callback: Callback): void; - history(): Promise; + history(callback: Callback): void; + history(): Promise; - get(callback: Callback): void; - get(): Promise; + get(callback: Callback): void; + get(): Promise; - push(options: {}, callback: Callback): void; - push(callback: Callback): void; - push(options?: {}): Promise; + push(options: {}, callback: Callback): void; + push(callback: Callback): void; + push(options?: {}): Promise; - tag(options: {}, callback: Callback): void; - tag(callback: Callback): void; - tag(options?: {}): Promise; + tag(options: {}, callback: Callback): void; + tag(callback: Callback): void; + tag(options?: {}): Promise; - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; - } + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + } - class Volume { - constructor(modem: any, name: string); + class Volume { + constructor(modem: any, name: string); - modem: any; - name: string; + modem: any; + name: string; - inspect(callback: Callback): void; - inspect(): Promise; + inspect(callback: Callback): void; + inspect(): Promise; - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; - } + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + } - class Service { - constructor(modem: any, id: string); + class Service { + constructor(modem: any, id: string); - modem: any; - id: string; + modem: any; + id: string; - inspect(callback: Callback): void; - inspect(): Promise; + inspect(callback: Callback): void; + inspect(): Promise; - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; - update(options: {}, callback: Callback): void; - update(options: {}): Promise; + update(options: {}, callback: Callback): void; + update(options: {}): Promise; - logs(options: ContainerLogsOptions, callback: Callback): void; - logs(callback: Callback): void; - logs(options?: ContainerLogsOptions): Promise; - } + logs(options: ContainerLogsOptions, callback: Callback): void; + logs(callback: Callback): void; + logs(options?: ContainerLogsOptions): Promise; + } - class Task { - constructor(modem: any, id: string); + class Task { + constructor(modem: any, id: string); - modem: any; - id: string; + modem: any; + id: string; - inspect(callback: Callback): void; - inspect(): Promise; - } + inspect(callback: Callback): void; + inspect(): Promise; + } - class Node { - constructor(modem: any, id: string); + class Node { + constructor(modem: any, id: string); - modem: any; - id: string; + modem: any; + id: string; - inspect(callback: Callback): void; - inspect(): Promise; + inspect(callback: Callback): void; + inspect(): Promise; - update(options: {}, callback: Callback): void; - update(callback: Callback): void; - update(options?: {}): Promise; + update(options: {}, callback: Callback): void; + update(callback: Callback): void; + update(options?: {}): Promise; - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; - } + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + } - class Plugin { - constructor(modem: any, name: string, remote?: any); + class Plugin { + constructor(modem: any, name: string, remote?: any); - modem: any; - name: string; - remote: any; + modem: any; + name: string; + remote: any; - inspect(callback: Callback): void; - inspect(): Promise; + inspect(callback: Callback): void; + inspect(): Promise; - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; - privileges(callback: Callback): void; - privileges(): Promise; + privileges(callback: Callback): void; + privileges(): Promise; - pull(options: {}, callback: Callback): void; - pull(options: {}): Promise; + pull(options: {}, callback: Callback): void; + pull(options: {}): Promise; - enable(options: {}, callback: Callback): void; - enable(callback: Callback): void; - enable(options?: {}): Promise; + enable(options: {}, callback: Callback): void; + enable(callback: Callback): void; + enable(options?: {}): Promise; - disable(options: {}, callback: Callback): void; - disable(callback: Callback): void; - disable(options?: {}): Promise; + disable(options: {}, callback: Callback): void; + disable(callback: Callback): void; + disable(options?: {}): Promise; - push(options: {}, callback: Callback): void; - push(callback: Callback): void; - push(options?: {}): Promise; + push(options: {}, callback: Callback): void; + push(callback: Callback): void; + push(options?: {}): Promise; - configure(options: {}, callback: Callback): void; - configure(callback: Callback): void; - configure(options?: {}): Promise; + configure(options: {}, callback: Callback): void; + configure(callback: Callback): void; + configure(options?: {}): Promise; - upgrade(auth: any, options: {}, callback: Callback): void; - upgrade(auth: any, callback: Callback): void; - upgrade(auth: any, options?: {}): Promise; - } + upgrade(auth: any, options: {}, callback: Callback): void; + upgrade(auth: any, callback: Callback): void; + upgrade(auth: any, options?: {}): Promise; + } - class Secret { - constructor(modem: any, id: string); - - modem: any; - id: string; - - inspect(callback: Callback): void; - inspect(): Promise; - - update(options: {}, callback: Callback): void; - update(callback: Callback): void; - update(options?: {}): Promise; - - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; - } - - class Network { - constructor(modem: any, id: string); - - modem: any; - id: string; - - inspect(callback: Callback): void; - inspect(): Promise; - - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; - - connect(options: {}, callback: Callback): void; - connect(callback: Callback): void; - connect(options?: {}): Promise; - - disconnect(options: {}, callback: Callback): void; - disconnect(callback: Callback): void; - disconnect(options?: {}): Promise; - } - - class Exec { - constructor(modem: any, id: string); - - modem: any; - id: string; - - inspect(callback: Callback): void; - inspect(): Promise; - - start(options: {}, callback: Callback): void; - start(options: {}): Promise; - - resize(options: {}, callback: Callback): void; - resize(options: {}): Promise; - } - - class Config { - constructor(modem: any, id: string); - - modem: any; - id: string; - - inspect(callback: Callback): void; - inspect(): Promise; - - update(options: {}, callback: Callback): void; - update(callback: Callback): void; - update(options?: {}): Promise; - - remove(options: {}, callback: Callback): void; - remove(callback: Callback): void; - remove(options?: {}): Promise; - } - - interface ImageInfo { - Id: string; - ParentId: string; - RepoTags: string[]; - RepoDigests?: string[]; - Created: number; - Size: number; - VirtualSize: number; - Labels: { [label: string]: string }; - } - - interface ContainerInfo { - Id: string; - Names: string[]; - Image: string; - ImageID: string; - Command: string; - Created: number; - Ports: Port[]; - Labels: { [label: string]: string }; - State: string; - Status: string; - HostConfig: { - NetworkMode: string; - }; - NetworkSettings: { - Networks: { [networkType: string]: NetworkInfo } - }; - Mounts: Array<{ - Name?: string; - Type: string; - Source: string; - Destination: string; - Driver?: string; - Mode: string; - RW: boolean; - Propagation: string; - }>; - } - - interface Port { - IP: string; - PrivatePort: number; - PublicPort: number; - Type: string; - } - - interface NetworkInfo { - IPAMConfig?: any; - Links?: any; - Aliases?: any; - NetworkID: string; - EndpointID: string; - Gateway: string; - IPAddress: string; - IPPrefixLen: number; - IPv6Gateway: string; - GlobalIPv6Address: string; - GlobalIPv6PrefixLen: number; - MacAddress: string; - } - - // Information returned from inspecting a network - interface NetworkInspectInfo { - Name: string; - Id: string; - Created: string; - Scope: string; - Driver: string; - EnableIPv6: boolean; - IPAM?: IPAM; - Internal: boolean; - Attachable: boolean; - Ingress: boolean; - Containers?: { [id: string]: NetworkContainer }; - Options?: { [key: string]: string }; - Labels?: { [key: string]: string }; - } - - interface NetworkContainer { - Name: string; - EndpointID: string; - MacAddress: string; - Ipv4Address: string; - IPv6Address: string; - } - - /* tslint:disable:interface-name */ - interface IPAM { - Driver: string; - Config?: { [key: string]: string }; - Options?: Array<{ [key: string]: string }>; - } - /* tslint:enable:interface-name */ - - interface VolumeInspectInfo { - Name: string; - Driver: string; - Mountpoint: string; - Status?: { [key: string]: string }; - Labels: { [key: string]: string }; - Scope: 'local' | 'global'; - // Field is always present, but sometimes is null - Options: { [key: string]: string } | null; - // Field is sometimes present, and sometimes null - UsageData?: { - Size: number; - RefCount: number; - } | null; - } - - interface ContainerInspectInfo { - Id: string; - Created: string; - Path: string; - Args: string[]; - State: { - Status: string; - Running: boolean; - Paused: boolean; - Restarting: boolean; - OOMKilled: boolean; - Dead: boolean; - Pid: number; - ExitCode: number; - Error: string; - StartedAt: string; - FinishedAt: string; - Health?: { + class Secret { + constructor(modem: any, id: string); + + modem: any; + id: string; + + inspect(callback: Callback): void; + inspect(): Promise; + + update(options: {}, callback: Callback): void; + update(callback: Callback): void; + update(options?: {}): Promise; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + } + + class Network { + constructor(modem: any, id: string); + + modem: any; + id: string; + + inspect(callback: Callback): void; + inspect(): Promise; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + + connect(options: {}, callback: Callback): void; + connect(callback: Callback): void; + connect(options?: {}): Promise; + + disconnect(options: {}, callback: Callback): void; + disconnect(callback: Callback): void; + disconnect(options?: {}): Promise; + } + + class Exec { + constructor(modem: any, id: string); + + modem: any; + id: string; + + inspect(callback: Callback): void; + inspect(): Promise; + + start(options: {}, callback: Callback): void; + start(options: {}): Promise; + + resize(options: {}, callback: Callback): void; + resize(options: {}): Promise; + } + + class Config { + constructor(modem: any, id: string); + + modem: any; + id: string; + + inspect(callback: Callback): void; + inspect(): Promise; + + update(options: {}, callback: Callback): void; + update(callback: Callback): void; + update(options?: {}): Promise; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + } + + interface ImageInfo { + Id: string; + ParentId: string; + RepoTags: string[]; + RepoDigests?: string[]; + Created: number; + Size: number; + VirtualSize: number; + Labels: { [label: string]: string }; + } + + interface ContainerInfo { + Id: string; + Names: string[]; + Image: string; + ImageID: string; + Command: string; + Created: number; + Ports: Port[]; + Labels: { [label: string]: string }; + State: string; Status: string; - FailingStreak: number; - Log: Array<{ - Start: string; - End: string; - ExitCode: number; - Output: string; - }>; - }; - }; - Image: string; - ResolvConfPath: string; - HostnamePath: string; - HostsPath: string; - LogPath: string; - Name: string; - RestartCount: number; - Driver: string; - MountLabel: string; - ProcessLabel: string; - AppArmorProfile: string; - ExecIDs?: any; - HostConfig: HostConfig; - GraphDriver: { - Name: string; - Data: { - DeviceId: string; - DeviceName: string; - DeviceSize: string; - } - }; - Mounts: Array<{ - Name?: string; - Source: string; - Destination: string; - Mode: string; - RW: boolean; - Propagation: string; - }>; - Config: { - Hostname: string; - Domainname: string; - User: string; - AttachStdin: boolean; - AttachStdout: boolean; - AttachStderr: boolean; - ExposedPorts: { [portAndProtocol: string]: {} }; - Tty: boolean; - OpenStdin: boolean; - StdinOnce: boolean; - Env: string[]; - Cmd: string[]; - Image: string; - Volumes: { [volume: string]: {} }; - WorkingDir: string; - Entrypoint?: string | string[]; - OnBuild?: any; - Labels: { [label: string]: string } - }; - NetworkSettings: { - Bridge: string; - SandboxID: string; - HairpinMode: boolean; - LinkLocalIPv6Address: string; - LinkLocalIPv6PrefixLen: number; - Ports: { - [portAndProtocol: string]: Array<{ - HostIp: string; - HostPort: string; - }>; - }; - SandboxKey: string; - SecondaryIPAddresses?: any; - SecondaryIPv6Addresses?: any; - EndpointID: string; - Gateway: string; - GlobalIPv6Address: string; - GlobalIPv6PrefixLen: number; - IPAddress: string; - IPPrefixLen: number; - IPv6Gateway: string; - MacAddress: string; - Networks: { - [type: string]: { - IPAMConfig?: any; - Links?: any; - Aliases?: any; - NetworkID: string; - EndpointID: string; - Gateway: string; - IPAddress: string; - IPPrefixLen: number; - IPv6Gateway: string; - GlobalIPv6Address: string; - GlobalIPv6PrefixLen: number; - MacAddress: string; + HostConfig: { + NetworkMode: string; }; - }; - Node?: { - ID: string; + NetworkSettings: { + Networks: { [networkType: string]: NetworkInfo }; + }; + Mounts: Array<{ + Name?: string; + Type: string; + Source: string; + Destination: string; + Driver?: string; + Mode: string; + RW: boolean; + Propagation: string; + }>; + } + + interface Port { IP: string; - Addr: string; + PrivatePort: number; + PublicPort: number; + Type: string; + } + + interface NetworkInfo { + IPAMConfig?: any; + Links?: any; + Aliases?: any; + NetworkID: string; + EndpointID: string; + Gateway: string; + IPAddress: string; + IPPrefixLen: number; + IPv6Gateway: string; + GlobalIPv6Address: string; + GlobalIPv6PrefixLen: number; + MacAddress: string; + } + + // Information returned from inspecting a network + interface NetworkInspectInfo { Name: string; - Cpus: number; - Memory: number; - Labels: any; - }; - }; - } + Id: string; + Created: string; + Scope: string; + Driver: string; + EnableIPv6: boolean; + IPAM?: IPAM; + Internal: boolean; + Attachable: boolean; + Ingress: boolean; + Containers?: { [id: string]: NetworkContainer }; + Options?: { [key: string]: string }; + Labels?: { [key: string]: string }; + } - interface NetworkStats { - [name: string]: { - rx_bytes: number; - rx_dropped: number; - rx_errors: number; - rx_packets: number; - tx_bytes: number; - tx_dropped: number; - tx_errors: number; - tx_packets: number; - }; - } + interface NetworkContainer { + Name: string; + EndpointID: string; + MacAddress: string; + Ipv4Address: string; + IPv6Address: string; + } - interface CPUStats { - cpu_usage: { - percpu_usage: number[]; - usage_in_usermode: number; - total_usage: number; - usage_in_kernelmode: number; - }; - system_cpu_usage: number; - online_cpus: number; - throttling_data: { - periods: number; - throttled_periods: number; - throttled_time: number; - }; - } + /* tslint:disable:interface-name */ + interface IPAM { + Driver: string; + Config?: { [key: string]: string }; + Options?: Array<{ [key: string]: string }>; + } + /* tslint:enable:interface-name */ - interface MemoryStats { - stats: { - total_pgmajfault: number; - cache: number; - mapped_file: number; - total_inactive_file: number; - pgpgout: number; - rss: number; - total_mapped_file: number; - writeback: number; - unevictable: number; - pgpgin: number; - total_unevictable: number; - pgmajfault: number; - total_rss: number; - total_rss_huge: number; - total_writeback: number; - total_inactive_anon: number; - rss_huge: number; - hierarchical_memory_limit: number; - total_pgfault: number; - total_active_file: number; - active_anon: number; - total_active_anon: number; - total_pgpgout: number; - total_cache: number; - inactive_anon: number; - active_file: number; - pgfault: number; - inactive_file: number; - total_pgpgin: number; - }; - max_usage: number; - usage: number; - failcnt: number; - limit: number; - } + interface VolumeInspectInfo { + Name: string; + Driver: string; + Mountpoint: string; + Status?: { [key: string]: string }; + Labels: { [key: string]: string }; + Scope: 'local' | 'global'; + // Field is always present, but sometimes is null + Options: { [key: string]: string } | null; + // Field is sometimes present, and sometimes null + UsageData?: { + Size: number; + RefCount: number; + } | null; + } - interface ContainerStats { - read: string; - pid_stats: { - current: number; - }; - networks: NetworkStats; - memory_stats: MemoryStats; - blkio_stats: {}; - cpu_stats: CPUStats; - precpu_stats: CPUStats; - } + interface ContainerInspectInfo { + Id: string; + Created: string; + Path: string; + Args: string[]; + State: { + Status: string; + Running: boolean; + Paused: boolean; + Restarting: boolean; + OOMKilled: boolean; + Dead: boolean; + Pid: number; + ExitCode: number; + Error: string; + StartedAt: string; + FinishedAt: string; + Health?: { + Status: string; + FailingStreak: number; + Log: Array<{ + Start: string; + End: string; + ExitCode: number; + Output: string; + }>; + }; + }; + Image: string; + ResolvConfPath: string; + HostnamePath: string; + HostsPath: string; + LogPath: string; + Name: string; + RestartCount: number; + Driver: string; + MountLabel: string; + ProcessLabel: string; + AppArmorProfile: string; + ExecIDs?: any; + HostConfig: HostConfig; + GraphDriver: { + Name: string; + Data: { + DeviceId: string; + DeviceName: string; + DeviceSize: string; + }; + }; + Mounts: Array<{ + Name?: string; + Source: string; + Destination: string; + Mode: string; + RW: boolean; + Propagation: string; + }>; + Config: { + Hostname: string; + Domainname: string; + User: string; + AttachStdin: boolean; + AttachStdout: boolean; + AttachStderr: boolean; + ExposedPorts: { [portAndProtocol: string]: {} }; + Tty: boolean; + OpenStdin: boolean; + StdinOnce: boolean; + Env: string[]; + Cmd: string[]; + Image: string; + Volumes: { [volume: string]: {} }; + WorkingDir: string; + Entrypoint?: string | string[]; + OnBuild?: any; + Labels: { [label: string]: string }; + }; + NetworkSettings: { + Bridge: string; + SandboxID: string; + HairpinMode: boolean; + LinkLocalIPv6Address: string; + LinkLocalIPv6PrefixLen: number; + Ports: { + [portAndProtocol: string]: Array<{ + HostIp: string; + HostPort: string; + }>; + }; + SandboxKey: string; + SecondaryIPAddresses?: any; + SecondaryIPv6Addresses?: any; + EndpointID: string; + Gateway: string; + GlobalIPv6Address: string; + GlobalIPv6PrefixLen: number; + IPAddress: string; + IPPrefixLen: number; + IPv6Gateway: string; + MacAddress: string; + Networks: { + [type: string]: { + IPAMConfig?: any; + Links?: any; + Aliases?: any; + NetworkID: string; + EndpointID: string; + Gateway: string; + IPAddress: string; + IPPrefixLen: number; + IPv6Gateway: string; + GlobalIPv6Address: string; + GlobalIPv6PrefixLen: number; + MacAddress: string; + }; + }; + Node?: { + ID: string; + IP: string; + Addr: string; + Name: string; + Cpus: number; + Memory: number; + Labels: any; + }; + }; + } - interface HostConfig { - AutoRemove?: boolean; - Binds?: string[]; - ContainerIDFile?: string; - LogConfig?: { - Type: string; - Config: any; - }; - NetworkMode?: string; - PortBindings?: any; - RestartPolicy?: RestartPolicy; - VolumeDriver?: string; - VolumesFrom?: any; - Mounts?: MountConfig; - CapAdd?: any; - CapDrop?: any; - Dns?: any[]; - DnsOptions?: any[]; - DnsSearch?: any[]; - ExtraHosts?: any; - GroupAdd?: string[]; - IpcMode?: string; - Cgroup?: string; - Links?: any; - OomScoreAdj?: number; - PidMode?: string; - Privileged?: boolean; - PublishAllPorts?: boolean; - ReadonlyRootfs?: boolean; - SecurityOpt?: any; - StorageOpt?: { [option: string]: string }; - Tmpfs?: { [dir: string]: string }; - UTSMode?: string; - UsernsMode?: string; - ShmSize?: number; - Sysctls?: { [index: string]: string }; - Runtime?: string; - ConsoleSize?: number[]; - Isolation?: string; - MaskedPaths?: string[]; - ReadonlyPaths?: string[]; - CpuShares?: number; - CgroupParent?: string; - BlkioWeight?: number; - BlkioWeightDevice?: any; - BlkioDeviceReadBps?: any; - BlkioDeviceWriteBps?: any; - BlkioDeviceReadIOps?: any; - BlkioDeviceWriteIOps?: any; - CpuPeriod?: number; - CpuQuota?: number; - CpusetCpus?: string; - CpusetMems?: string; - Devices?: any; - DeviceCgroupRules?: string[]; - DeviceRequests?: DeviceRequest[]; - DiskQuota?: number; - KernelMemory?: number; - Memory?: number; - MemoryReservation?: number; - MemorySwap?: number; - MemorySwappiness?: number; - OomKillDisable?: boolean; - PidsLimit?: number; - Ulimits?: any; - } + interface NetworkStats { + [name: string]: { + rx_bytes: number; + rx_dropped: number; + rx_errors: number; + rx_packets: number; + tx_bytes: number; + tx_dropped: number; + tx_errors: number; + tx_packets: number; + }; + } - interface ImageInspectInfo { - Id: string; - RepoTags: string[]; - RepoDigests: string[]; - Parent: string; - Comment: string; - Created: string; - Container: string; - ContainerConfig: - { - Hostname: string; - Domainname: string; - User: string; - AttachStdin: boolean; - AttachStdout: boolean; - AttachStderr: boolean; - ExposedPorts: { [portAndProtocol: string]: {} }; - Tty: boolean; - OpenStdin: boolean; - StdinOnce: boolean; - Env: string[]; - Cmd: string[]; - ArgsEscaped: boolean; - Image: string; - Volumes: { [path: string]: {} }, - WorkingDir: string; - Entrypoint?: string | string[]; - OnBuild?: any[]; - Labels: { [label: string]: string } - }; - DockerVersion: string; - Author: string; - Config: - { - Hostname: string; - Domainname: string; - User: string; - AttachStdin: boolean; - AttachStdout: boolean; - AttachStderr: boolean; - ExposedPorts: { [portAndProtocol: string]: {} } - Tty: boolean; - OpenStdin: boolean; - StdinOnce: boolean; - Env: string[]; - Cmd: string[]; - ArgsEscaped: boolean; - Image: string; - Volumes: { [path: string]: {} }, - WorkingDir: string; - Entrypoint?: string | string[]; - OnBuild: any[]; - Labels: { [label: string]: string } - }; - Architecture: string; - Os: string; - Size: number; - VirtualSize: number; - GraphDriver: - { - Name: string; - Data: - { - DeviceId: string; - DeviceName: string; - DeviceSize: string; - } - }; - RootFS: { - Type: string; - Layers?: string[]; - BaseLayer?: string; - }; - } + interface CPUStats { + cpu_usage: { + percpu_usage: number[]; + usage_in_usermode: number; + total_usage: number; + usage_in_kernelmode: number; + }; + system_cpu_usage: number; + online_cpus: number; + throttling_data: { + periods: number; + throttled_periods: number; + throttled_time: number; + }; + } - interface AuthConfig { - username: string; - password: string; - serveraddress: string; - email?: string; - } + interface MemoryStats { + stats: { + total_pgmajfault: number; + cache: number; + mapped_file: number; + total_inactive_file: number; + pgpgout: number; + rss: number; + total_mapped_file: number; + writeback: number; + unevictable: number; + pgpgin: number; + total_unevictable: number; + pgmajfault: number; + total_rss: number; + total_rss_huge: number; + total_writeback: number; + total_inactive_anon: number; + rss_huge: number; + hierarchical_memory_limit: number; + total_pgfault: number; + total_active_file: number; + active_anon: number; + total_active_anon: number; + total_pgpgout: number; + total_cache: number; + inactive_anon: number; + active_file: number; + pgfault: number; + inactive_file: number; + total_pgpgin: number; + }; + max_usage: number; + usage: number; + failcnt: number; + limit: number; + } - interface PortBinding { - HostIp?: string; - HostPort?: string; - } + interface ContainerStats { + read: string; + pid_stats: { + current: number; + }; + networks: NetworkStats; + memory_stats: MemoryStats; + blkio_stats: {}; + cpu_stats: CPUStats; + precpu_stats: CPUStats; + } - interface PortMap { - [key: string]: PortBinding[]; - } + interface HostConfig { + AutoRemove?: boolean; + Binds?: string[]; + ContainerIDFile?: string; + LogConfig?: { + Type: string; + Config: any; + }; + NetworkMode?: string; + PortBindings?: any; + RestartPolicy?: RestartPolicy; + VolumeDriver?: string; + VolumesFrom?: any; + Mounts?: MountConfig; + CapAdd?: any; + CapDrop?: any; + Dns?: any[]; + DnsOptions?: any[]; + DnsSearch?: any[]; + ExtraHosts?: any; + GroupAdd?: string[]; + IpcMode?: string; + Cgroup?: string; + Links?: any; + OomScoreAdj?: number; + PidMode?: string; + Privileged?: boolean; + PublishAllPorts?: boolean; + ReadonlyRootfs?: boolean; + SecurityOpt?: any; + StorageOpt?: { [option: string]: string }; + Tmpfs?: { [dir: string]: string }; + UTSMode?: string; + UsernsMode?: string; + ShmSize?: number; + Sysctls?: { [index: string]: string }; + Runtime?: string; + ConsoleSize?: number[]; + Isolation?: string; + MaskedPaths?: string[]; + ReadonlyPaths?: string[]; + CpuShares?: number; + CgroupParent?: string; + BlkioWeight?: number; + BlkioWeightDevice?: any; + BlkioDeviceReadBps?: any; + BlkioDeviceWriteBps?: any; + BlkioDeviceReadIOps?: any; + BlkioDeviceWriteIOps?: any; + CpuPeriod?: number; + CpuQuota?: number; + CpusetCpus?: string; + CpusetMems?: string; + Devices?: any; + DeviceCgroupRules?: string[]; + DeviceRequests?: DeviceRequest[]; + DiskQuota?: number; + KernelMemory?: number; + Memory?: number; + MemoryReservation?: number; + MemorySwap?: number; + MemorySwappiness?: number; + OomKillDisable?: boolean; + PidsLimit?: number; + Ulimits?: any; + } - interface RestartPolicy { - Name: string; - MaximumRetryCount?: number; - } + interface ImageInspectInfo { + Id: string; + RepoTags: string[]; + RepoDigests: string[]; + Parent: string; + Comment: string; + Created: string; + Container: string; + ContainerConfig: { + Hostname: string; + Domainname: string; + User: string; + AttachStdin: boolean; + AttachStdout: boolean; + AttachStderr: boolean; + ExposedPorts: { [portAndProtocol: string]: {} }; + Tty: boolean; + OpenStdin: boolean; + StdinOnce: boolean; + Env: string[]; + Cmd: string[]; + ArgsEscaped: boolean; + Image: string; + Volumes: { [path: string]: {} }; + WorkingDir: string; + Entrypoint?: string | string[]; + OnBuild?: any[]; + Labels: { [label: string]: string }; + }; + DockerVersion: string; + Author: string; + Config: { + Hostname: string; + Domainname: string; + User: string; + AttachStdin: boolean; + AttachStdout: boolean; + AttachStderr: boolean; + ExposedPorts: { [portAndProtocol: string]: {} }; + Tty: boolean; + OpenStdin: boolean; + StdinOnce: boolean; + Env: string[]; + Cmd: string[]; + ArgsEscaped: boolean; + Image: string; + Volumes: { [path: string]: {} }; + WorkingDir: string; + Entrypoint?: string | string[]; + OnBuild: any[]; + Labels: { [label: string]: string }; + }; + Architecture: string; + Os: string; + Size: number; + VirtualSize: number; + GraphDriver: { + Name: string; + Data: { + DeviceId: string; + DeviceName: string; + DeviceSize: string; + }; + }; + RootFS: { + Type: string; + Layers?: string[]; + BaseLayer?: string; + }; + } - type LoggingDriverType = - | "json-file" - | "syslog" - | "journald" - | "gelf" - | "fluentd" - | "awslogs" - | "splunk" - | "etwlogs" - | "none"; + interface AuthConfig { + username: string; + password: string; + serveraddress: string; + email?: string; + } - interface LogConfig { - Type: LoggingDriverType; - Config?: { [key: string]: string }; - } + interface PortBinding { + HostIp?: string; + HostPort?: string; + } - interface DeviceMapping { - PathOnHost: string; - PathInContainer: string; - CgroupPermissions: string; - } + interface PortMap { + [key: string]: PortBinding[]; + } - interface DeviceRequest { - Driver?: string; - Count?: number; - DeviceIDs?: string[]; - Capabilities?: string[][]; - Options?: { [key: string]: string }; - } + interface RestartPolicy { + Name: string; + MaximumRetryCount?: number; + } - /* tslint:disable:interface-name */ - interface IPAMConfig { - IPv4Address?: string; - IPv6Address?: string; - LinkLocalIPs?: string[]; - } - /* tslint:enable:interface-name */ + type LoggingDriverType = + | 'json-file' + | 'syslog' + | 'journald' + | 'gelf' + | 'fluentd' + | 'awslogs' + | 'splunk' + | 'etwlogs' + | 'none'; - interface EndpointSettings { - IPAMConfig?: IPAMConfig; - Links?: string[]; - Aliases?: string[]; - NetworkID?: string; - EndpointID?: string; - Gateway?: string; - IPAddress?: string; - IPPrefixLen?: number; - IPv6Gateway?: string; - GlobalIPv6Address?: string; - GlobalIPV6PrefixLen?: number; - MacAddress?: string; - DriverOpts?: { [key: string]: string }; - } + interface LogConfig { + Type: LoggingDriverType; + Config?: { [key: string]: string }; + } - interface EndpointsConfig { - [key: string]: EndpointSettings; - } + interface DeviceMapping { + PathOnHost: string; + PathInContainer: string; + CgroupPermissions: string; + } - type MountType = - | "bind" - | "volume" - | "tmpfs"; + interface DeviceRequest { + Driver?: string; + Count?: number; + DeviceIDs?: string[]; + Capabilities?: string[][]; + Options?: { [key: string]: string }; + } - type MountConsistency = - | "default" - | "consistent" - | "cached" - | "delegated"; + /* tslint:disable:interface-name */ + interface IPAMConfig { + IPv4Address?: string; + IPv6Address?: string; + LinkLocalIPs?: string[]; + } + /* tslint:enable:interface-name */ - type MountPropagation = - | "private" - | "rprivate" - | "shared" - | "rshared" - | "slave" - | "rslave"; + interface EndpointSettings { + IPAMConfig?: IPAMConfig; + Links?: string[]; + Aliases?: string[]; + NetworkID?: string; + EndpointID?: string; + Gateway?: string; + IPAddress?: string; + IPPrefixLen?: number; + IPv6Gateway?: string; + GlobalIPv6Address?: string; + GlobalIPV6PrefixLen?: number; + MacAddress?: string; + DriverOpts?: { [key: string]: string }; + } - interface MountSettings { - Target: string; - Source: string; - Type: MountType; - ReadOnly ?: boolean; - Consistency ?: MountConsistency; - BindOptions ?: { - Propagation: MountPropagation; - }; - VolumeOptions ?: { - NoCopy: boolean; - Labels: { [label: string]: string }; - DriverConfig: { - Name: string; - Options: { [option: string]: string}; - }; - }; - TmpfsOptions ?: { - SizeBytes: number; - Mode: number; - }; - } + interface EndpointsConfig { + [key: string]: EndpointSettings; + } - type MountConfig = MountSettings[]; + type MountType = 'bind' | 'volume' | 'tmpfs'; - interface ContainerCreateOptions { - name?: string; - Hostname?: string; - Domainname?: string; - User?: string; - AttachStdin?: boolean; - AttachStdout?: boolean; - AttachStderr?: boolean; - Tty?: boolean; - OpenStdin?: boolean; - StdinOnce?: boolean; - Env?: string[]; - Cmd?: string[]; - Entrypoint?: string | string[]; - Image?: string; - Labels?: { [label: string]: string }; - Volumes?: { [volume: string]: {} }; - WorkingDir?: string; - NetworkDisabled?: boolean; - MacAddress?: boolean; - ExposedPorts?: { [port: string]: {} }; - StopSignal?: string; - StopTimeout?: number; - HostConfig?: HostConfig; - NetworkingConfig?: { - EndpointsConfig?: EndpointsConfig; - }; - } + type MountConsistency = 'default' | 'consistent' | 'cached' | 'delegated'; - interface KeyObject { - pem: string | Buffer; - passphrase?: string; - } + type MountPropagation = 'private' | 'rprivate' | 'shared' | 'rshared' | 'slave' | 'rslave'; - interface DockerOptions { - socketPath?: string; - host?: string; - port?: number | string; - ca?: string | string[] | Buffer | Buffer[]; - cert?: string | string[] | Buffer | Buffer[]; - key?: string | string[] | Buffer | Buffer[] | KeyObject[]; - protocol?: "https" | "http"; - timeout?: number; - version?: string; - Promise?: typeof Promise; - } + interface MountSettings { + Target: string; + Source: string; + Type: MountType; + ReadOnly?: boolean; + Consistency?: MountConsistency; + BindOptions?: { + Propagation: MountPropagation; + }; + VolumeOptions?: { + NoCopy: boolean; + Labels: { [label: string]: string }; + DriverConfig: { + Name: string; + Options: { [option: string]: string }; + }; + }; + TmpfsOptions?: { + SizeBytes: number; + Mode: number; + }; + } - interface GetEventsOptions { - since?: number; - until?: number; - filters?: string; - } + type MountConfig = MountSettings[]; - interface SecretVersion { - Index: number; - } + interface ContainerCreateOptions { + name?: string; + Hostname?: string; + Domainname?: string; + User?: string; + AttachStdin?: boolean; + AttachStdout?: boolean; + AttachStderr?: boolean; + Tty?: boolean; + OpenStdin?: boolean; + StdinOnce?: boolean; + Env?: string[]; + Cmd?: string[]; + Entrypoint?: string | string[]; + Image?: string; + Labels?: { [label: string]: string }; + Volumes?: { [volume: string]: {} }; + WorkingDir?: string; + NetworkDisabled?: boolean; + MacAddress?: boolean; + ExposedPorts?: { [port: string]: {} }; + StopSignal?: string; + StopTimeout?: number; + HostConfig?: HostConfig; + NetworkingConfig?: { + EndpointsConfig?: EndpointsConfig; + }; + } - interface ServiceSpec { - Name: string; - } + interface KeyObject { + pem: string | Buffer; + passphrase?: string; + } - interface SecretInfo { - ID: string; - Version: SecretVersion; - CreatedAt: string; - UpdatedAt?: string; - Spec?: ServiceSpec; - } + interface DockerOptions { + socketPath?: string; + host?: string; + port?: number | string; + ca?: string | string[] | Buffer | Buffer[]; + cert?: string | string[] | Buffer | Buffer[]; + key?: string | string[] | Buffer | Buffer[] | KeyObject[]; + protocol?: 'https' | 'http'; + timeout?: number; + version?: string; + Promise?: typeof Promise; + } - interface ConfigInfo { - ID: string; - Version: SecretVersion; - CreatedAt: string; - UpdatedAt?: string; - Spec?: ConfigSpec; - } + interface GetEventsOptions { + since?: number; + until?: number; + filters?: + | string + | { + config?: string; + container?: string[]; + daemon?: string[]; + event?: string[]; + image?: string[]; + label?: string[]; + network?: string[]; + node?: string[]; + plugin?: string[]; + scope?: Array<'local' | 'swarm'>; + secret?: string[]; + service?: string[]; + type?: Array< + | 'container' + | 'image' + | 'volume' + | 'network' + | 'daemon' + | 'plugin' + | 'service' + | 'node' + | 'secret' + | 'config' + >; + volume?: string[]; + }; + } - interface ConfigSpec { - Name: string; - Labels: { [label: string]: string }; - Data: string; - } + interface SecretVersion { + Index: number; + } - interface ConfigVersion { - Index: number; - } + interface ServiceSpec { + Name: string; + } - interface PluginInfo { - Id?: string; - Name: string; - Enabled: boolean; - Settings: PluginSettings; - PluginReference?: string; - Config: PluginConfig; - } + interface SecretInfo { + ID: string; + Version: SecretVersion; + CreatedAt: string; + UpdatedAt?: string; + Spec?: ServiceSpec; + } - type PluginInspectInfo = PluginInfo; + interface ConfigInfo { + ID: string; + Version: SecretVersion; + CreatedAt: string; + UpdatedAt?: string; + Spec?: ConfigSpec; + } - interface PluginSettings { - Mounts: PluginMount[]; - Env: string[]; - Args: string[]; - Devices: PluginDevice[]; - } + interface ConfigSpec { + Name: string; + Labels: { [label: string]: string }; + Data: string; + } - interface PluginConfig { - Description: string; - Documentation: string; - Interface: any; - Entrypoint: string[]; - WorkDir: string; - User?: User; - Network: Network; - Linux: Linux; - PropagatedMount: string; - Mounts: PluginMount[]; - Env: PluginEnv[]; - Args: Args; - rootfs: any; - } + interface ConfigVersion { + Index: number; + } - interface Interface { - Types: PluginInterfaceType[]; - Socket: string; - } + interface PluginInfo { + Id?: string; + Name: string; + Enabled: boolean; + Settings: PluginSettings; + PluginReference?: string; + Config: PluginConfig; + } - interface PluginInterfaceType { - Prefix: string; - Capability: string; - Version: string; - } + type PluginInspectInfo = PluginInfo; - interface PluginMount { - Name: string; - Description: string; - Settable: string[]; - Source: string; - Destination: string; - Type: string; - Options: string[]; - } + interface PluginSettings { + Mounts: PluginMount[]; + Env: string[]; + Args: string[]; + Devices: PluginDevice[]; + } - interface Linux { - Capabilities: string[]; - AllowAllDevices: boolean; - Devices: PluginDevice[]; - } + interface PluginConfig { + Description: string; + Documentation: string; + Interface: any; + Entrypoint: string[]; + WorkDir: string; + User?: User; + Network: Network; + Linux: Linux; + PropagatedMount: string; + Mounts: PluginMount[]; + Env: PluginEnv[]; + Args: Args; + rootfs: any; + } - interface PluginDevice { - Name: string; - Description: string; - Settable: string[]; - Path: string; - } + interface Interface { + Types: PluginInterfaceType[]; + Socket: string; + } - interface Network { - Type: string; - } + interface PluginInterfaceType { + Prefix: string; + Capability: string; + Version: string; + } - interface PluginEnv { - Name: string; - Description: string; - Settable: string[]; - Value: string; - } + interface PluginMount { + Name: string; + Description: string; + Settable: string[]; + Source: string; + Destination: string; + Type: string; + Options: string[]; + } - interface Args { - Name: string; - Description: string; - Settable: string[]; - Value: string; - } + interface Linux { + Capabilities: string[]; + AllowAllDevices: boolean; + Devices: PluginDevice[]; + } - interface User { - UID: number; - GID: number; - } + interface PluginDevice { + Name: string; + Description: string; + Settable: string[]; + Path: string; + } - interface ImageRemoveInfo { - Untagged: string; - Deleted: string; - } + interface Network { + Type: string; + } - interface PruneImagesInfo { - ImagesDeleted: ImageRemoveInfo[]; - SpaceReclaimed: number; - } + interface PluginEnv { + Name: string; + Description: string; + Settable: string[]; + Value: string; + } - interface PruneVolumesInfo { - VolumesDeleted: string[]; - SpaceReclaimed: number; - } + interface Args { + Name: string; + Description: string; + Settable: string[]; + Value: string; + } - interface PruneContainersInfo { - ContainersDeleted: string[]; - SpaceReclaimed: number; - } + interface User { + UID: number; + GID: number; + } - interface PruneNetworksInfo { - NetworksDeleted: string[]; - } + interface ImageRemoveInfo { + Untagged: string; + Deleted: string; + } - interface ContainerLogsOptions { - stdout?: boolean; - stderr?: boolean; - follow?: boolean; - since?: number; - details?: boolean; - tail?: number; - timestamps?: boolean; - } + interface PruneImagesInfo { + ImagesDeleted: ImageRemoveInfo[]; + SpaceReclaimed: number; + } - interface ImageBuildContext { - context: string; - src: string[]; - } + interface PruneVolumesInfo { + VolumesDeleted: string[]; + SpaceReclaimed: number; + } - interface DockerVersion { - ApiVersion: string; - Arch: string; - BuildTime: Date; - Components: Array<{ - Details: { + interface PruneContainersInfo { + ContainersDeleted: string[]; + SpaceReclaimed: number; + } + + interface PruneNetworksInfo { + NetworksDeleted: string[]; + } + + interface ContainerLogsOptions { + stdout?: boolean; + stderr?: boolean; + follow?: boolean; + since?: number; + details?: boolean; + tail?: number; + timestamps?: boolean; + } + + interface ImageBuildContext { + context: string; + src: string[]; + } + + interface DockerVersion { ApiVersion: string; Arch: string; BuildTime: Date; - Experimental: string; + Components: Array<{ + Details: { + ApiVersion: string; + Arch: string; + BuildTime: Date; + Experimental: string; + GitCommit: string; + GoVersion: string; + KernelVersion: string; + Os: string; + }; + Name: string; + Version: string; + }>; GitCommit: string; GoVersion: string; KernelVersion: string; + MinAPIVersion: string; Os: string; - }; - Name: string; - Version: string; - }>; - GitCommit: string; - GoVersion: string; - KernelVersion: string; - MinAPIVersion: string; - Os: string; - Platform: { - Name: string; - }; - Version: string; - } + Platform: { + Name: string; + }; + Version: string; + } } type Callback = (error?: any, result?: T) => void; declare class Dockerode { - constructor(options?: Dockerode.DockerOptions); + constructor(options?: Dockerode.DockerOptions); - createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback): void; - createContainer(options: Dockerode.ContainerCreateOptions): Promise; + createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback): void; + createContainer(options: Dockerode.ContainerCreateOptions): Promise; - createImage(options: {}, callback: Callback): void; - createImage(auth: any, options: {}, callback: Callback): void; - createImage(options: {}): Promise; - createImage(auth: any, options: {}): Promise; + createImage(options: {}, callback: Callback): void; + createImage(auth: any, options: {}, callback: Callback): void; + createImage(options: {}): Promise; + createImage(auth: any, options: {}): Promise; - loadImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; - loadImage(file: string | NodeJS.ReadableStream, callback: Callback): void; - loadImage(file: string | NodeJS.ReadableStream, options?: {}): Promise; + loadImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; + loadImage(file: string | NodeJS.ReadableStream, callback: Callback): void; + loadImage(file: string | NodeJS.ReadableStream, options?: {}): Promise; - importImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; - importImage(file: string | NodeJS.ReadableStream, callback: Callback): void; - importImage(file: string | NodeJS.ReadableStream, options?: {}): Promise; + importImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; + importImage(file: string | NodeJS.ReadableStream, callback: Callback): void; + importImage(file: string | NodeJS.ReadableStream, options?: {}): Promise; - checkAuth(options: any, callback: Callback): void; - checkAuth(options: any): Promise; + checkAuth(options: any, callback: Callback): void; + checkAuth(options: any): Promise; - buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options: {}, callback: Callback): void; - buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, callback: Callback): void; - buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options?: {}): Promise; + buildImage( + file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, + options: {}, + callback: Callback, + ): void; + buildImage( + file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, + callback: Callback, + ): void; + buildImage( + file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, + options?: {}, + ): Promise; - getContainer(id: string): Dockerode.Container; + getContainer(id: string): Dockerode.Container; - getImage(name: string): Dockerode.Image; + getImage(name: string): Dockerode.Image; - getVolume(name: string): Dockerode.Volume; + getVolume(name: string): Dockerode.Volume; - getPlugin(name: string, remote: any): Dockerode.Plugin; + getPlugin(name: string, remote: any): Dockerode.Plugin; - getService(id: string): Dockerode.Service; + getService(id: string): Dockerode.Service; - getTask(id: string): Dockerode.Task; + getTask(id: string): Dockerode.Task; - getNode(id: string): Dockerode.Node; + getNode(id: string): Dockerode.Node; - getNetwork(id: string): Dockerode.Network; + getNetwork(id: string): Dockerode.Network; - getSecret(id: string): Dockerode.Secret; + getSecret(id: string): Dockerode.Secret; - getExec(id: string): Dockerode.Exec; + getExec(id: string): Dockerode.Exec; - getConfig(id: string): Dockerode.Config; + getConfig(id: string): Dockerode.Config; - listContainers(options: {}, callback: Callback): void; - listContainers(callback: Callback): void; - listContainers(options?: {}): Promise; + listContainers(options: {}, callback: Callback): void; + listContainers(callback: Callback): void; + listContainers(options?: {}): Promise; - listImages(options: {}, callback: Callback): void; - listImages(callback: Callback): void; - listImages(options?: {}): Promise; + listImages(options: {}, callback: Callback): void; + listImages(callback: Callback): void; + listImages(options?: {}): Promise; - listServices(options: {}, callback: Callback): void; - listServices(callback: Callback): void; - listServices(options?: {}): Promise; + listServices(options: {}, callback: Callback): void; + listServices(callback: Callback): void; + listServices(options?: {}): Promise; - listNodes(options: {}, callback: Callback): void; - listNodes(callback: Callback): void; - listNodes(options?: {}): Promise; + listNodes(options: {}, callback: Callback): void; + listNodes(callback: Callback): void; + listNodes(options?: {}): Promise; - listTasks(options: {}, callback: Callback): void; - listTasks(callback: Callback): void; - listTasks(options?: {}): Promise; + listTasks(options: {}, callback: Callback): void; + listTasks(callback: Callback): void; + listTasks(options?: {}): Promise; - listSecrets(options: {}, callback: Callback): void; - listSecrets(callback: Callback): void; - listSecrets(options?: {}): Promise; + listSecrets(options: {}, callback: Callback): void; + listSecrets(callback: Callback): void; + listSecrets(options?: {}): Promise; - listPlugins(options: {}, callback: Callback): void; - listPlugins(callback: Callback): void; - listPlugins(options?: {}): Promise; + listPlugins(options: {}, callback: Callback): void; + listPlugins(callback: Callback): void; + listPlugins(options?: {}): Promise; - listVolumes(options: {}, callback: Callback<{ - Volumes: Dockerode.VolumeInspectInfo[]; - Warnings: string[]; - }>): void; - listVolumes(callback: Callback<{ - Volumes: Dockerode.VolumeInspectInfo[]; - Warnings: string[]; - }>): void; - listVolumes(options?: {}): Promise<{ - Volumes: Dockerode.VolumeInspectInfo[]; - Warnings: string[]; - }>; + listVolumes( + options: {}, + callback: Callback<{ + Volumes: Dockerode.VolumeInspectInfo[]; + Warnings: string[]; + }>, + ): void; + listVolumes( + callback: Callback<{ + Volumes: Dockerode.VolumeInspectInfo[]; + Warnings: string[]; + }>, + ): void; + listVolumes(options?: {}): Promise<{ + Volumes: Dockerode.VolumeInspectInfo[]; + Warnings: string[]; + }>; - listNetworks(options: {}, callback: Callback): void; - listNetworks(callback: Callback): void; - listNetworks(options?: {}): Promise; + listNetworks(options: {}, callback: Callback): void; + listNetworks(callback: Callback): void; + listNetworks(options?: {}): Promise; - listConfigs(options: {}, callback: Callback): void; - listConfigs(callback: Callback): void; - listConfigs(options?: {}): Promise; + listConfigs(options: {}, callback: Callback): void; + listConfigs(callback: Callback): void; + listConfigs(options?: {}): Promise; - createSecret(options: {}, callback: Callback): void; - createSecret(options: {}): Promise; + createSecret(options: {}, callback: Callback): void; + createSecret(options: {}): Promise; - createConfig(options: {}, callback: Callback): void; - createConfig(options: {}): Promise; + createConfig(options: {}, callback: Callback): void; + createConfig(options: {}): Promise; - createPlugin(options: {}, callback: Callback): void; - createPlugin(options: {}): Promise; + createPlugin(options: {}, callback: Callback): void; + createPlugin(options: {}): Promise; - createVolume(options: {}, callback: Callback): void; - createVolume(options: {}): Promise; + createVolume(options: {}, callback: Callback): void; + createVolume(options: {}): Promise; - createService(options: {}, callback: Callback): void; - createService(options: {}): Promise; + createService(options: {}, callback: Callback): void; + createService(options: {}): Promise; - createNetwork(options: {}, callback: Callback): void; - createNetwork(options: {}): Promise; + createNetwork(options: {}, callback: Callback): void; + createNetwork(options: {}): Promise; - searchImages(options: {}, callback: Callback): void; - searchImages(options: {}): Promise; + searchImages(options: {}, callback: Callback): void; + searchImages(options: {}): Promise; - pruneImages(options: {}, callback: Callback): void; - pruneImages(callback: Callback): void; - pruneImages(options?: {}): Promise; + pruneImages(options: {}, callback: Callback): void; + pruneImages(callback: Callback): void; + pruneImages(options?: {}): Promise; - pruneContainers(options: {}, callback: Callback): void; - pruneContainers(callback: Callback): void; - pruneContainers(options?: {}): Promise; + pruneContainers(options: {}, callback: Callback): void; + pruneContainers(callback: Callback): void; + pruneContainers(options?: {}): Promise; - pruneVolumes(options: {}, callback: Callback): void; - pruneVolumes(callback: Callback): void; - pruneVolumes(options?: {}): Promise; + pruneVolumes(options: {}, callback: Callback): void; + pruneVolumes(callback: Callback): void; + pruneVolumes(options?: {}): Promise; - pruneNetworks(options: {}, callback: Callback): void; - pruneNetworks(callback: Callback): void; - pruneNetworks(options?: {}): Promise; + pruneNetworks(options: {}, callback: Callback): void; + pruneNetworks(callback: Callback): void; + pruneNetworks(options?: {}): Promise; - info(callback: Callback): void; - info(): Promise; + info(callback: Callback): void; + info(): Promise; - df(callback: Callback): void; - df(): Promise; + df(callback: Callback): void; + df(): Promise; - version(callback: Callback): void; - version(): Promise; + version(callback: Callback): void; + version(): Promise; - ping(callback: Callback): void; - ping(): Promise; + ping(callback: Callback): void; + ping(): Promise; - getEvents(options: Dockerode.GetEventsOptions, callback: Callback): void; - getEvents(callback: Callback): void; - getEvents(options?: Dockerode.GetEventsOptions): Promise; + getEvents(options: Dockerode.GetEventsOptions, callback: Callback): void; + getEvents(callback: Callback): void; + getEvents(options?: Dockerode.GetEventsOptions): Promise; - pull(repoTag: string, options: {}, callback: Callback, auth?: {}): Dockerode.Image; - pull(repoTag: string, options: {}, auth?: {}): Promise; + pull(repoTag: string, options: {}, callback: Callback, auth?: {}): Dockerode.Image; + pull(repoTag: string, options: {}, auth?: {}): Promise; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions: {}, startOptions: {}, callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], startOptions: {}, callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions: {}, callback: Callback): events.EventEmitter; - run(image: string, cmd: string[], outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], createOptions?: {}, startOptions?: {}): Promise; + run( + image: string, + cmd: string[], + outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], + createOptions: {}, + startOptions: {}, + callback: Callback, + ): events.EventEmitter; + run( + image: string, + cmd: string[], + outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], + startOptions: {}, + callback: Callback, + ): events.EventEmitter; + run( + image: string, + cmd: string[], + outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], + callback: Callback, + ): events.EventEmitter; + run( + image: string, + cmd: string[], + outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], + createOptions: {}, + callback: Callback, + ): events.EventEmitter; + run( + image: string, + cmd: string[], + outputStream: NodeJS.WritableStream | NodeJS.WritableStream[], + createOptions?: {}, + startOptions?: {}, + ): Promise; - swarmInit(options: {}, callback: Callback): void; - swarmInit(options: {}): Promise; + swarmInit(options: {}, callback: Callback): void; + swarmInit(options: {}): Promise; - swarmJoin(options: {}, callback: Callback): void; - swarmJoin(options: {}): Promise; + swarmJoin(options: {}, callback: Callback): void; + swarmJoin(options: {}): Promise; - swarmLeave(options: {}, callback: Callback): void; - swarmLeave(options: {}): Promise; + swarmLeave(options: {}, callback: Callback): void; + swarmLeave(options: {}): Promise; - swarmUpdate(options: {}, callback: Callback): void; - swarmUpdate(options: {}): Promise; + swarmUpdate(options: {}, callback: Callback): void; + swarmUpdate(options: {}): Promise; - swarmInspect(callback: Callback): void; - swarmInspect(): Promise; + swarmInspect(callback: Callback): void; + swarmInspect(): Promise; - modem: any; + modem: any; } export = Dockerode;