diff --git a/pkg/ocihook/ocihook.go b/pkg/ocihook/ocihook.go index 2aa14101c82..910ff3aebd4 100644 --- a/pkg/ocihook/ocihook.go +++ b/pkg/ocihook/ocihook.go @@ -503,6 +503,7 @@ func applyNetworkSettings(opts *handlerOpts) (err error) { if err != nil { log.L.Debugf("killing the port reserver process (pid=%d)", reserverCmdPid) _ = reserverCmd.Process.Kill() + _ = os.RemoveAll(filepath.Dir(portReserverPidFilePath(opts))) } }() if err := writePidFile(portReserverPidFilePath(opts), reserverCmdPid); err != nil {