File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
2424 "path/filepath"
2525
2626 "github.com/containerd/containerd/identifiers"
27+ "github.com/containerd/containerd/mount"
2728 "github.com/containerd/containerd/namespaces"
2829 "github.com/pkg/errors"
2930)
@@ -116,6 +117,13 @@ type Bundle struct {
116117// Delete a bundle atomically
117118func (b * Bundle ) Delete () error {
118119 work , werr := os .Readlink (filepath .Join (b .Path , "work" ))
120+ rootfs := filepath .Join (b .Path , "rootfs" )
121+ if err := mount .UnmountAll (rootfs , 0 ); err != nil {
122+ return errors .Wrapf (err , "unmount rootfs %s" , rootfs )
123+ }
124+ if err := os .Remove (rootfs ); err != nil && os .IsNotExist (err ) {
125+ return errors .Wrap (err , "failed to remove bundle rootfs" )
126+ }
119127 err := atomicDelete (b .Path )
120128 if err == nil {
121129 if werr == nil {
You can’t perform that action at this time.
0 commit comments