Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions daemon/graphdriver/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/fsutils"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/opencontainers/runc/libcontainer/label"
)

Expand Down Expand Up @@ -134,6 +135,10 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, err
}

if err := mount.MakePrivate(home); err != nil {
return nil, err
}

supportsDType, err := fsutils.SupportsDType(home)
if err != nil {
return nil, err
Expand Down Expand Up @@ -217,10 +222,11 @@ func (d *Driver) GetMetadata(id string) (map[string]string, error) {
return metadata, nil
}

// Cleanup simply returns nil and do not change the existing filesystem.
// This is required to satisfy the graphdriver.Driver interface.
// Cleanup any state created by overlay which should be cleaned when daemon
// is being shutdown. For now, we just have to unmount the bind mounted
// we had created.
func (d *Driver) Cleanup() error {
return nil
return mount.Unmount(d.home)
}

// CreateReadWrite creates a layer that is writable for use as a container
Expand Down
12 changes: 9 additions & 3 deletions daemon/graphdriver/overlay2/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/docker/docker/pkg/directory"
"github.com/docker/docker/pkg/fsutils"
"github.com/docker/docker/pkg/idtools"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel"
units "github.com/docker/go-units"
Expand Down Expand Up @@ -160,6 +161,10 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, err
}

if err := mount.MakePrivate(home); err != nil {
return nil, err
}

supportsDType, err := fsutils.SupportsDType(home)
if err != nil {
return nil, err
Expand Down Expand Up @@ -283,10 +288,11 @@ func (d *Driver) GetMetadata(id string) (map[string]string, error) {
return metadata, nil
}

// Cleanup simply returns nil and do not change the existing filesystem.
// This is required to satisfy the graphdriver.Driver interface.
// Cleanup any state created by overlay which should be cleaned when daemon
// is being shutdown. For now, we just have to unmount the bind mounted
// we had created.
func (d *Driver) Cleanup() error {
return nil
return mount.Unmount(d.home)
}

// CreateReadWrite creates a layer that is writable for use as a container
Expand Down