Skip to content

Commit de508fd

Browse files
committed
Add cleanup IO process after nerdctl stop
1 parent 401800a commit de508fd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/containerutil/containerutil.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,16 @@ func Stop(ctx context.Context, container containerd.Container, timeout *time.Dur
385385
return err
386386
}
387387

388+
// Cleanup the IO after a successful Stop
389+
io := task.IO()
390+
if io != nil {
391+
defer func() {
392+
if cerr := io.Close(); cerr != nil {
393+
log.G(ctx).Warnf("failed to close IO for container %s: %v", container.ID(), cerr)
394+
}
395+
}()
396+
}
397+
388398
status, err := task.Status(ctx)
389399
if err != nil {
390400
return err

0 commit comments

Comments
 (0)