Skip to content

Commit 525dd43

Browse files
author
Christian Weichel
committed
[runc-facade] Don't replace proc mount
1 parent 9095f87 commit 525dd43

File tree

1 file changed

+0
-51
lines changed
  • components/docker-up/runc-facade

1 file changed

+0
-51
lines changed

components/docker-up/runc-facade/main.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ var (
2020
defaultOOMScoreAdj = 1000
2121
)
2222

23-
const (
24-
cmdMountProc = "mount-proc"
25-
cmdUnmountProc = "unmount-proc"
26-
)
27-
2823
func main() {
2924
log := logrus.New()
3025
log.SetLevel(logrus.DebugLevel)
@@ -66,12 +61,7 @@ func createAndRunc(runcPath string) error {
6661
}
6762

6863
cfg.Process.OOMScoreAdj = &defaultOOMScoreAdj
69-
replaceProcMount(&cfg)
7064
replaceSysMount(&cfg)
71-
err = addHooks(&cfg)
72-
if err != nil {
73-
return fmt.Errorf("canot add hooks: %w", err)
74-
}
7565

7666
fc, err = json.Marshal(cfg)
7767
if err != nil {
@@ -91,30 +81,6 @@ func createAndRunc(runcPath string) error {
9181
return nil
9282
}
9383

94-
func replaceProcMount(cfg *specs.Spec) {
95-
var n int
96-
for _, m := range cfg.Mounts {
97-
if m.Destination == "/proc" {
98-
continue
99-
}
100-
101-
cfg.Mounts[n] = m
102-
n++
103-
}
104-
105-
cfg.Mounts = cfg.Mounts[:n]
106-
// TODO(cw): add daemon-mounted proc
107-
cfg.Mounts = append(cfg.Mounts, specs.Mount{
108-
Destination: "/proc",
109-
Options: []string{
110-
"rbind",
111-
"rprivate",
112-
},
113-
Source: "/proc",
114-
Type: "bind",
115-
})
116-
}
117-
11884
func replaceSysMount(cfg *specs.Spec) {
11985
var n int
12086
for _, m := range cfg.Mounts {
@@ -137,20 +103,3 @@ func replaceSysMount(cfg *specs.Spec) {
137103
Type: "bind",
138104
})
139105
}
140-
141-
func addHooks(cfg *specs.Spec) error {
142-
self, err := os.Executable()
143-
if err != nil {
144-
return err
145-
}
146-
147-
cfg.Hooks.Prestart = append(cfg.Hooks.Prestart, specs.Hook{
148-
Path: self,
149-
Args: []string{cmdMountProc},
150-
})
151-
cfg.Hooks.Poststop = append(cfg.Hooks.Poststop, specs.Hook{
152-
Path: self,
153-
Args: []string{cmdUnmountProc},
154-
})
155-
return nil
156-
}

0 commit comments

Comments
 (0)