mirror of https://github.com/containers/podman.git
Merge pull request #4821 from AkihiroSuda/fix-rootlessport
rootlessport: remove state dir on exit + honor ctr.runtime.config.TmpDir
This commit is contained in:
commit
fe49aa0f50
|
|
@ -344,6 +344,7 @@ func (r *Runtime) setupRootlessPortMapping(ctr *Container, netnsPath string) (er
|
||||||
NetNSPath: netnsPath,
|
NetNSPath: netnsPath,
|
||||||
ExitFD: 3,
|
ExitFD: 3,
|
||||||
ReadyFD: 4,
|
ReadyFD: 4,
|
||||||
|
TmpDir: ctr.runtime.config.TmpDir,
|
||||||
}
|
}
|
||||||
cfgJSON, err := json.Marshal(cfg)
|
cfgJSON, err := json.Marshal(cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ type Config struct {
|
||||||
NetNSPath string
|
NetNSPath string
|
||||||
ExitFD int
|
ExitFD int
|
||||||
ReadyFD int
|
ReadyFD int
|
||||||
|
TmpDir string
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -101,10 +102,11 @@ func parent() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the parent driver
|
// create the parent driver
|
||||||
stateDir, err := ioutil.TempDir("", "rootlessport")
|
stateDir, err := ioutil.TempDir(cfg.TmpDir, "rootlessport")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer os.RemoveAll(stateDir)
|
||||||
driver, err := rkbuiltin.NewParentDriver(&logrusWriter{prefix: "parent: "}, stateDir)
|
driver, err := rkbuiltin.NewParentDriver(&logrusWriter{prefix: "parent: "}, stateDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue