fix entrypoint without cmd

This commit is contained in:
Isao Jonas 2013-08-04 19:11:23 -05:00
parent a37b42b57c
commit 0f249c85ea
2 changed files with 6 additions and 2 deletions

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")
}

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
}