@@ -21,6 +21,7 @@ package windows
2121import (
2222 "context"
2323 "fmt"
24+ "io/ioutil"
2425 "os"
2526 "sync"
2627 "time"
@@ -247,13 +248,17 @@ func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, root
247248 }
248249 }()
249250
250- if err := mount .All (rootfs , "" ); err != nil {
251+ mountLocation , err := ioutil .TempDir ("" , "containerd-rootfs" )
252+ if err != nil {
253+ return nil , errors .Wrap (err , "failed to create temp rootfs folder" )
254+ }
255+ if err := mount .All (rootfs , mountLocation ); err != nil {
251256 return nil , errors .Wrap (err , "failed to mount rootfs" )
252257 }
253258 defer func () {
254259 if err != nil {
255- if err := mount .UnmountAll (rootfs [ 0 ]. Source , 0 ); err != nil {
256- log .G (ctx ).WithError (err ).WithField ("path" , rootfs [ 0 ]. Source ).
260+ if err := mount .UnmountAll (mountLocation , 0 ); err != nil {
261+ log .G (ctx ).WithError (err ).WithField ("path" , mountLocation ).
257262 Warn ("failed to unmount rootfs on failure" )
258263 }
259264 }
@@ -295,6 +300,7 @@ func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, root
295300 publisher : r .publisher ,
296301 rwLayer : conf .LayerFolderPath ,
297302 rootfs : rootfs ,
303+ mountLocation : mountLocation ,
298304 pidPool : r .pidPool ,
299305 hcsContainer : ctr ,
300306 terminateDuration : createOpts .TerminateDuration ,
0 commit comments