Skip to content

Commit 0f249c8

Browse files
committed
fix entrypoint without cmd
1 parent a37b42b commit 0f249c8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

builder.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ func (builder *Builder) Create(config *Config) (*Container, error) {
3838
MergeConfig(config, img.Config)
3939
}
4040

41-
if config.Cmd == nil || len(config.Cmd) == 0 {
41+
if len(config.Entrypoint) != 0 && config.Cmd == nil {
42+
config.Cmd = []string{}
43+
} else if config.Cmd == nil || len(config.Cmd) == 0 {
4244
return nil, fmt.Errorf("No command specified")
4345
}
4446

buildfile.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ func (b *buildFile) CmdRun(args string) error {
9393
b.config.Cmd = nil
9494
MergeConfig(b.config, config)
9595

96+
defer func(cmd []string) { b.config.Cmd = cmd }(cmd)
97+
9698
utils.Debugf("Command to be executed: %v", b.config.Cmd)
9799

98100
if b.utilizeCache {
@@ -115,7 +117,7 @@ func (b *buildFile) CmdRun(args string) error {
115117
if err := b.commit(cid, cmd, "run"); err != nil {
116118
return err
117119
}
118-
b.config.Cmd = cmd
120+
119121
return nil
120122
}
121123

0 commit comments

Comments
 (0)