Skip to content

Commit f1ca1f9

Browse files
committed
fix containers
Signed-off-by: Darren Stahl <[email protected]>
1 parent f34d796 commit f1ca1f9

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

windows/runtime.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package windows
2121
import (
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,

windows/task.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ type task struct {
4848
processes map[string]*process
4949
hyperV bool
5050

51-
publisher events.Publisher
52-
rwLayer string
53-
rootfs []mount.Mount
51+
publisher events.Publisher
52+
rwLayer string
53+
mountLocation string
54+
rootfs []mount.Mount
5455

5556
pidPool *pidPool
5657
hcsContainer hcsshim.Container

0 commit comments

Comments
 (0)