Skip to content

Commit f5a981e

Browse files
authored
Merge pull request #4811 from haytok/fix-cleanup-port-reserver-pid
fix: clean up port-reserver.pid and the parent dir when the container…
2 parents 23751b8 + b34858e commit f5a981e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/ocihook/ocihook.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,9 @@ func onPostStop(opts *handlerOpts) error {
748748
if err = killProcessByPidFile(portReserverPidFile); err != nil {
749749
log.L.WithError(err).Errorf("failed to kill the port-reserver process")
750750
}
751+
if err := os.RemoveAll(filepath.Dir(portReserverPidFile)); err != nil {
752+
log.L.WithError(err).Errorf("failed to remove the port-reserver directory %s", filepath.Dir(portReserverPidFile))
753+
}
751754
return nil
752755
}
753756

0 commit comments

Comments
 (0)