implement .createContainer()

This commit is contained in:
2016-06-17 02:38:00 +02:00
parent c356042075
commit 4da7f5194a
3 changed files with 62 additions and 13 deletions

View File

@ -59,10 +59,20 @@ export class Dockersock {
pullImage(imageLabel:string){
return this.requestStream("POST","/images/create?fromImage=" + imageLabel);
};
createContainer(imageNameArg,pullFirst:boolean = true){
return this.request("POST","/containers/create","",{
"image":imageNameArg
});
createContainer(optionsArg,pullFirstArg:boolean = true){
let done = plugins.q.defer();
let create = () => {
return this.request("POST","/containers/create","",optionsArg);
}
if(pullFirstArg){
this.pullImage(optionsArg.Image)
.then(create)
.then(done.resolve);
} else {
create()
.then(done.resolve)
}
return done.promise;
};
getContainerId(){