fix entrypoint without cmd

Upstream-commit: 0f249c85ea9acc7fba33994aa5d20a897463db2c
Component: engine
This commit is contained in:
Isao Jonas
2013-08-05 09:07:03 -05:00
parent 8f44de0140
commit fe0fe92945
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -38,7 +38,9 @@ func (builder *Builder) Create(config *Config) (*Container, error) {
MergeConfig(config, img.Config)
}
if config.Cmd == nil || len(config.Cmd) == 0 {
if len(config.Entrypoint) != 0 && config.Cmd == nil {
config.Cmd = []string{}
} else if config.Cmd == nil || len(config.Cmd) == 0 {
return nil, fmt.Errorf("No command specified")
}
+3 -1
View File
@@ -93,6 +93,8 @@ func (b *buildFile) CmdRun(args string) error {
b.config.Cmd = nil
MergeConfig(b.config, config)
defer func(cmd []string) { b.config.Cmd = cmd }(cmd)
utils.Debugf("Command to be executed: %v", b.config.Cmd)
if b.utilizeCache {
@@ -115,7 +117,7 @@ func (b *buildFile) CmdRun(args string) error {
if err := b.commit(cid, cmd, "run"); err != nil {
return err
}
b.config.Cmd = cmd
return nil
}