Skip to content

Commit 3e87f05

Browse files
Fix image pulling with Transfer service
Signed-off-by: Ethan Lowman <[email protected]>
1 parent eebd4ad commit 3e87f05

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

plugins/transfer/plugin.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@ import (
2020
"fmt"
2121

2222
"github.com/containerd/containerd"
23+
"github.com/containerd/containerd/diff"
2324
"github.com/containerd/containerd/leases"
2425
"github.com/containerd/containerd/metadata"
2526
"github.com/containerd/containerd/pkg/transfer/local"
2627
"github.com/containerd/containerd/pkg/unpack"
2728
"github.com/containerd/containerd/platforms"
2829
"github.com/containerd/containerd/plugin"
30+
"github.com/containerd/containerd/snapshots"
2931

3032
// Load packages with type registrations
3133
_ "github.com/containerd/containerd/pkg/transfer/archive"
3234
_ "github.com/containerd/containerd/pkg/transfer/image"
35+
_ "github.com/containerd/containerd/pkg/transfer/registry"
3336
)
3437

3538
// Register local transfer service plugin
@@ -40,6 +43,8 @@ func init() {
4043
Requires: []plugin.Type{
4144
plugin.LeasePlugin,
4245
plugin.MetadataPlugin,
46+
plugin.SnapshotPlugin,
47+
plugin.DiffPlugin,
4348
},
4449
Config: defaultConfig(),
4550
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
@@ -54,6 +59,11 @@ func init() {
5459
return nil, err
5560
}
5661

62+
d, err := ic.Get(plugin.DiffPlugin)
63+
if err != nil {
64+
return nil, err
65+
}
66+
5767
// Set configuration based on default or user input
5868
var lc local.TransferConfig
5969
lc.MaxConcurrentDownloads = config.maxConcurrentDownloads
@@ -64,9 +74,16 @@ func init() {
6474
return nil, fmt.Errorf("%s: platform configuration %v invalid", plugin.TransferPlugin, uc.platform)
6575
}
6676

77+
s, err := ic.GetByID(plugin.SnapshotPlugin, uc.snapshotter)
78+
if err != nil {
79+
return nil, err
80+
}
81+
6782
up := unpack.Platform{
6883
Platform: platforms.OnlyStrict(p),
6984
SnapshotterKey: uc.snapshotter,
85+
Snapshotter: s.(snapshots.Snapshotter),
86+
Applier: d.(diff.Applier),
7087
}
7188
lc.UnpackPlatforms = append(lc.UnpackPlatforms, up)
7289
}

0 commit comments

Comments
 (0)