Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 54c75d8

Browse files
committed
fix the issue of missing cmd from container image
When there is no cmd specified in pod config or run command, pick the command from the container image. Signed-off-by: fupan <lifupan@gmail.com>
1 parent 978c818 commit 54c75d8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

daemon/pod/container.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,12 @@ func (c *Container) containerConfig(cjson *dockertypes.ContainerJSON) (*vc.Conta
625625
c.spec.StopSignal = "TERM"
626626
}
627627

628+
if len(c.spec.Command) == 0 {
629+
for _, cmd := range cjson.Config.Cmd.Slice() {
630+
c.spec.Command = append(c.spec.Command, cmd)
631+
}
632+
}
633+
628634
ociSpec = c.ociSpec(cjson)
629635
ociSpecJson, err := json.Marshal(ociSpec)
630636
if err != nil {

0 commit comments

Comments
 (0)