@@ -614,7 +614,7 @@ 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 ()
@@ -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,13 @@ 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
- }
668
+ for _ , cmd := range cjson .Config .Entrypoint .Slice () {
669
+ cmds = append (cmds , cmd )
671
670
}
672
671
673
- ociSpec = c .ociSpec (cjson )
672
+ cmds = append (cmds , c .spec .Command ... )
673
+
674
+ ociSpec = c .ociSpec (cjson , cmds )
674
675
675
676
//remove those namespace types from ocispec
676
677
for _ , ns := range []specs.LinuxNamespaceType {
@@ -714,7 +715,7 @@ func (c *Container) containerConfig(cjson *dockertypes.ContainerJSON) (*vc.Conta
714
715
}
715
716
716
717
cmd := vc.Cmd {
717
- Args : c . spec . Command ,
718
+ Args : cmds ,
718
719
Envs : c .cmdEnvs ([]vc.EnvVar {}),
719
720
WorkDir : c .spec .Workdir ,
720
721
User : user ,
0 commit comments