From 92e821cf47dbe15da73cb80b6682418dce22c287 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Sun, 18 Oct 2015 16:05:03 -0700 Subject: [PATCH] Make default command bash Signed-off-by: Jeffrey Morgan --- src/utils/DockerUtil.js | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/utils/DockerUtil.js b/src/utils/DockerUtil.js index 0b7d0ec26b..3d56210d33 100644 --- a/src/utils/DockerUtil.js +++ b/src/utils/DockerUtil.js @@ -101,20 +101,28 @@ export default { containerData.Env = containerData.Config.Env; } - containerData.Volumes = _.mapObject(containerData.Volumes, () => {return {};}); + containerData.Volumes = _.mapObject(containerData.Volumes, () => {}); - let existing = this.client.getContainer(name); - existing.kill(() => { - existing.remove(() => { - this.client.createContainer(containerData, (error) => { - if (error) { - containerServerActions.error({name, error}); - return; - } - metrics.track('Container Finished Creating'); - this.startContainer(name, containerData); - delete this.placeholders[name]; - localStorage.setItem('placeholders', JSON.stringify(this.placeholders)); + this.client.getImage(containerData.Image).inspect((error, image) => { + if (error) { + containerServerActions.error({name, error}); + return; + } + + containerData.Cmd = image.Config.Cmd || 'bash'; + let existing = this.client.getContainer(name); + existing.kill(() => { + existing.remove(() => { + this.client.createContainer(containerData, (error) => { + if (error) { + containerServerActions.error({name, error}); + return; + } + metrics.track('Container Finished Creating'); + this.startContainer(name, containerData); + delete this.placeholders[name]; + localStorage.setItem('placeholders', JSON.stringify(this.placeholders)); + }); }); }); });