From fa6ba6802618e3e23746c4b4707fb403a55514ae Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Sat, 22 Aug 2020 18:15:53 +0800 Subject: fix apiv2 will create containers with incorrect commands Signed-off-by: zhangguanzhang --- pkg/spec/spec.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'pkg/spec/spec.go') diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index 893ae3cab..5e97620cc 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -180,7 +180,16 @@ func (config *CreateConfig) createConfigToOCISpec(runtime *libpod.Runtime, userM g.AddMount(cgroupMnt) } g.SetProcessCwd(config.WorkDir) - g.SetProcessArgs(config.Command) + + ProcessArgs := make([]string, 0) + if len(config.Entrypoint) > 0 { + ProcessArgs = config.Entrypoint + } + if len(config.Command) > 0 { + ProcessArgs = append(ProcessArgs, config.Command...) + } + g.SetProcessArgs(ProcessArgs) + g.SetProcessTerminal(config.Tty) for key, val := range config.Annotations { -- cgit v1.2.3-54-g00ecf