@@ -614,14 +614,14 @@ func (c *Container) ociEnv() []string {
614
614
return envs
615
615
}
616
616
617
- func (c * Container ) ociSpec (cjson * dockertypes.ContainerJSON ) * specs.Spec {
617
+ func (c * Container ) ociSpec (cjson * dockertypes.ContainerJSON , cmds [] string ) * specs.Spec {
618
618
var ocispec specs.Spec
619
619
620
620
ocispec = oci .DefaultSpec ()
621
621
ocispec .Root .Path = ROOTFS
622
622
ocispec .Root .Readonly = c .spec .ReadOnly
623
623
624
- ocispec .Process .Args = c . spec . Command
624
+ ocispec .Process .Args = cmds
625
625
ocispec .Process .Env = c .ociEnv ()
626
626
ocispec .Process .Cwd = c .spec .Workdir
627
627
ocispec .Process .Terminal = c .spec .Tty
@@ -650,6 +650,7 @@ func (c *Container) ociSpec(cjson *dockertypes.ContainerJSON) *specs.Spec {
650
650
func (c * Container ) containerConfig (cjson * dockertypes.ContainerJSON ) (* vc.ContainerConfig , error ) {
651
651
var user , group string
652
652
var ociSpec * specs.Spec
653
+ var cmds []string
653
654
654
655
c .Log (TRACE , "container info config %#v, Cmd %v, Args %v" , cjson .Config , cjson .Config .Cmd .Slice (), cjson .Args )
655
656
@@ -664,13 +665,10 @@ func (c *Container) containerConfig(cjson *dockertypes.ContainerJSON) (*vc.Conta
664
665
c .spec .StopSignal = "TERM"
665
666
}
666
667
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
- }
671
- }
668
+ cmds = append (cmds , cjson .Config .Entrypoint .Slice ()... )
669
+ cmds = append (cmds , cjson .Config .Cmd .Slice ()... )
672
670
673
- ociSpec = c .ociSpec (cjson )
671
+ ociSpec = c .ociSpec (cjson , cmds )
674
672
675
673
//remove those namespace types from ocispec
676
674
for _ , ns := range []specs.LinuxNamespaceType {
@@ -714,7 +712,7 @@ func (c *Container) containerConfig(cjson *dockertypes.ContainerJSON) (*vc.Conta
714
712
}
715
713
716
714
cmd := vc.Cmd {
717
- Args : c . spec . Command ,
715
+ Args : cmds ,
718
716
Envs : c .cmdEnvs ([]vc.EnvVar {}),
719
717
WorkDir : c .spec .Workdir ,
720
718
User : user ,
0 commit comments