@@ -614,7 +614,7 @@ func (c *Container) ociEnv() []string {
614614return envs
615615}
616616
617- func (c * Container ) ociSpec (cjson * dockertypes.ContainerJSON ) * specs.Spec {
617+ func (c * Container ) ociSpec (cjson * dockertypes.ContainerJSON , cmds [] string ) * specs.Spec {
618618var ocispec specs.Spec
619619
620620ocispec = oci .DefaultSpec ()
@@ -650,6 +650,7 @@ func (c *Container) ociSpec(cjson *dockertypes.ContainerJSON) *specs.Spec {
650650func (c * Container ) containerConfig (cjson * dockertypes.ContainerJSON ) (* vc.ContainerConfig , error ) {
651651var user , group string
652652var ociSpec * specs.Spec
653+ var cmds []string
653654
654655c .Log (TRACE , "container info config %#v, Cmd %v, Args %v" , cjson .Config , cjson .Config .Cmd .Slice (), cjson .Args )
655656
@@ -664,13 +665,13 @@ func (c *Container) containerConfig(cjson *dockertypes.ContainerJSON) (*vc.Conta
664665c .spec .StopSignal = "TERM"
665666}
666667
667- if len (c .spec .Command ) == 0 {
668- for _ , cmd := range cjson .Config .Cmd .Slice () {
669- c .spec .Command = append (c .spec .Command , cmd )
670- }
668+ for _ , cmd := range cjson .Config .Entrypoint .Slice () {
669+ cmds = append (cmds , cmd )
671670}
672671
673- ociSpec = c .ociSpec (cjson )
672+ cmds = append (cmds , c .spec .Command ... )
673+
674+ ociSpec = c .ociSpec (cjson , cmds )
674675
675676//remove those namespace types from ocispec
676677for _ , ns := range []specs.LinuxNamespaceType {
@@ -714,7 +715,7 @@ func (c *Container) containerConfig(cjson *dockertypes.ContainerJSON) (*vc.Conta
714715}
715716
716717cmd := vc.Cmd {
717- Args : c . spec . Command ,
718+ Args : cmds ,
718719Envs : c .cmdEnvs ([]vc.EnvVar {}),
719720WorkDir : c .spec .Workdir ,
720721User : user ,
0 commit comments