mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Add support and tests for Dockerode promise API (#16337)
This commit is contained in:
committed by
Mohamed Hegazy
parent
1b926c986b
commit
ef8ff1dff4
@@ -24,6 +24,25 @@ const docker6 = new Docker({
|
||||
key: 'key'
|
||||
});
|
||||
|
||||
const docker7 = new Docker({
|
||||
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 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 container = docker.getContainer('container-id');
|
||||
container.inspect((err, data) => {
|
||||
// NOOP
|
||||
@@ -47,6 +66,10 @@ docker.listContainers((err, containers) => {
|
||||
});
|
||||
});
|
||||
|
||||
docker.listContainers().then(containers => {
|
||||
return containers.map(container => docker.getContainer(container.Id));
|
||||
});
|
||||
|
||||
docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => {
|
||||
// NOOP
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user