Skip to content
Merged
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
11 changes: 10 additions & 1 deletion daemon/mgr/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,25 @@ func (mgr *ContainerManager) Restore(ctx context.Context) error {

// Create checks passed in parameters and create a Container object whose status is set at Created.
func (mgr *ContainerManager) Create(ctx context.Context, name string, config *types.ContainerCreateConfig) (resp *types.ContainerCreateResp, err error) {
currentSnapshotter := ctrd.CurrentSnapshotterName(ctx)
config.Snapshotter = currentSnapshotter

if mgr.containerPlugin != nil {
logrus.Infof("invoke container pre-create hook in plugin")
if ex := mgr.containerPlugin.PreCreate(config); ex != nil {
return nil, errors.Wrapf(ex, "pre-create plugin point execute failed")
}
}

// Attention, since we support multi snapshotter, if snapshotter not changed,
// means plugin not change it, so remove value in case to effect origin logic
if config.Snapshotter == currentSnapshotter {
config.Snapshotter = ""
}

// NOTE: choose snapshotter, snapshotter can only be set
// through containerPlugin in Create function
ctx = ctrd.WithSnapshotter(ctx, config.ContainerConfig.Snapshotter)
ctx = ctrd.WithSnapshotter(ctx, config.Snapshotter)

// cleanup allocated resources when failed
cleanups := []func() error{}
Expand Down