@@ -504,6 +504,7 @@ func (c *Container) createByEngine() (*dockertypes.ContainerJSON, error) {
504
504
if len (c .spec .Envs ) != 0 {
505
505
envs := []string {}
506
506
for _ , env := range c .spec .Envs {
507
+
507
508
envs = append (envs , env .Env + "=" + env .Value )
508
509
}
509
510
config .Env = envs
@@ -529,6 +530,19 @@ func (c *Container) createByEngine() (*dockertypes.ContainerJSON, error) {
529
530
return nil , err
530
531
}
531
532
533
+ for _ , v := range rsp .Config .Env {
534
+ pair := strings .SplitN (v , "=" , 2 )
535
+ var env = apitypes.EnvironmentVar {}
536
+
537
+ if len (pair ) == 2 {
538
+ env = apitypes.EnvironmentVar {Env : pair [0 ], Value : pair [1 ]}
539
+ } else if len (pair ) == 1 {
540
+ env = apitypes.EnvironmentVar {Env : pair [0 ], Value : "" }
541
+ }
542
+
543
+ c .spec .Envs = append (c .spec .Envs , & env )
544
+ }
545
+
532
546
c .spec .Id = ccs .ID
533
547
c .updateLogPrefix ()
534
548
return rsp , nil
@@ -567,17 +581,13 @@ func containerMounts(cjson *dockertypes.ContainerJSON) []vc.Mount {
567
581
return mnts
568
582
}
569
583
570
- func (c * Container ) ociEnv (cjson * dockertypes. ContainerJSON ) []string {
584
+ func (c * Container ) ociEnv () []string {
571
585
var envs []string
572
586
573
587
for _ , env := range c .spec .Envs {
574
588
envs = append (envs , env .Env + "=" + env .Value )
575
589
}
576
590
577
- for _ , env := range cjson .Config .Env {
578
- envs = append (envs , env )
579
- }
580
-
581
591
return envs
582
592
}
583
593
@@ -589,7 +599,7 @@ func (c *Container) ociSpec(cjson *dockertypes.ContainerJSON) *specs.Spec {
589
599
ocispec .Root .Readonly = c .spec .ReadOnly
590
600
591
601
ocispec .Process .Args = c .spec .Command
592
- ocispec .Process .Env = c .ociEnv (cjson )
602
+ ocispec .Process .Env = c .ociEnv ()
593
603
ocispec .Process .Cwd = c .spec .Workdir
594
604
ocispec .Process .Terminal = c .spec .Tty
595
605
/*
0 commit comments