Add support and tests for Dockerode promise API (#16337)

This commit is contained in:
Carl Winkler
2017-05-06 00:01:16 +08:00
committed by Mohamed Hegazy
parent 1b926c986b
commit ef8ff1dff4
3 changed files with 130 additions and 2 deletions

View File

@@ -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
});