@@ -27,6 +27,10 @@ import (
27
27
"golang.org/x/sys/unix"
28
28
)
29
29
30
+ const (
31
+ inContainerInitPath = "/sbin/" + daemonconfig .DefaultInitBinary
32
+ )
33
+
30
34
func setResources (s * specs.Spec , r containertypes.Resources ) error {
31
35
weightDevices , err := getBlkioWeightDevices (r )
32
36
if err != nil {
@@ -657,19 +661,16 @@ func (daemon *Daemon) populateCommonSpec(s *specs.Spec, c *container.Container)
657
661
if c .HostConfig .PidMode .IsPrivate () {
658
662
if (c .HostConfig .Init != nil && * c .HostConfig .Init ) ||
659
663
(c .HostConfig .Init == nil && daemon .configStore .Init ) {
660
- s .Process .Args = append ([]string {"/dev/init" , "--" , c .Path }, c .Args ... )
661
- var path string
662
- if daemon . configStore . InitPath == "" {
664
+ s .Process .Args = append ([]string {inContainerInitPath , "--" , c .Path }, c .Args ... )
665
+ path := daemon . configStore . InitPath
666
+ if path == "" {
663
667
path , err = exec .LookPath (daemonconfig .DefaultInitBinary )
664
668
if err != nil {
665
669
return err
666
670
}
667
671
}
668
- if daemon .configStore .InitPath != "" {
669
- path = daemon .configStore .InitPath
670
- }
671
672
s .Mounts = append (s .Mounts , specs.Mount {
672
- Destination : "/dev/init" ,
673
+ Destination : inContainerInitPath ,
673
674
Type : "bind" ,
674
675
Source : path ,
675
676
Options : []string {"bind" , "ro" },
0 commit comments