Browse code

fixing consistent aliases for OCI spec imports

Signed-off-by: Jeyanthinath Muthuram <jeyanthinath10@gmail.com>

Jeyanthinath Muthuram authored on 2023/05/08 18:57:52
Showing 45 changed files
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	containerpkg "github.com/docker/docker/container"
22 22
 	"github.com/docker/docker/errdefs"
23 23
 	"github.com/docker/docker/pkg/ioutils"
24
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
24
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
25 25
 	"github.com/pkg/errors"
26 26
 	"github.com/sirupsen/logrus"
27 27
 	"golang.org/x/net/websocket"
... ...
@@ -566,7 +566,7 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
566 566
 		hostConfig.Annotations = nil
567 567
 	}
568 568
 
569
-	var platform *specs.Platform
569
+	var platform *ocispec.Platform
570 570
 	if versions.GreaterThanOrEqualTo(version, "1.41") {
571 571
 		if v := r.Form.Get("platform"); v != "" {
572 572
 			p, err := platforms.Parse(v)
... ...
@@ -12,7 +12,7 @@ import (
12 12
 	"github.com/docker/docker/api/server/httputils"
13 13
 	"github.com/docker/docker/api/types/registry"
14 14
 	"github.com/docker/docker/errdefs"
15
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
15
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
16 16
 	"github.com/pkg/errors"
17 17
 )
18 18
 
... ...
@@ -61,7 +61,7 @@ func (s *distributionRouter) getDistributionInfo(ctx context.Context, w http.Res
61 61
 		if err != nil {
62 62
 			return err
63 63
 		}
64
-		distributionInspect.Descriptor = v1.Descriptor{
64
+		distributionInspect.Descriptor = ocispec.Descriptor{
65 65
 			MediaType: descriptor.MediaType,
66 66
 			Digest:    descriptor.Digest,
67 67
 			Size:      descriptor.Size,
... ...
@@ -107,7 +107,7 @@ func (s *distributionRouter) getDistributionInfo(ctx context.Context, w http.Res
107 107
 	switch mnfstObj := mnfst.(type) {
108 108
 	case *manifestlist.DeserializedManifestList:
109 109
 		for _, m := range mnfstObj.Manifests {
110
-			distributionInspect.Platforms = append(distributionInspect.Platforms, v1.Platform{
110
+			distributionInspect.Platforms = append(distributionInspect.Platforms, ocispec.Platform{
111 111
 				Architecture: m.Platform.Architecture,
112 112
 				OS:           m.Platform.OS,
113 113
 				OSVersion:    m.Platform.OSVersion,
... ...
@@ -117,7 +117,7 @@ func (s *distributionRouter) getDistributionInfo(ctx context.Context, w http.Res
117 117
 		}
118 118
 	case *schema2.DeserializedManifest:
119 119
 		configJSON, err := blobsrvc.Get(ctx, mnfstObj.Config.Digest)
120
-		var platform v1.Platform
120
+		var platform ocispec.Platform
121 121
 		if err == nil {
122 122
 			err := json.Unmarshal(configJSON, &platform)
123 123
 			if err == nil && (platform.OS != "" || platform.Architecture != "") {
... ...
@@ -125,7 +125,7 @@ func (s *distributionRouter) getDistributionInfo(ctx context.Context, w http.Res
125 125
 			}
126 126
 		}
127 127
 	case *schema1.SignedManifest:
128
-		platform := v1.Platform{
128
+		platform := ocispec.Platform{
129 129
 			Architecture: mnfstObj.Architecture,
130 130
 			OS:           "linux",
131 131
 		}
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"github.com/docker/docker/api/types/image"
11 11
 	"github.com/docker/docker/api/types/registry"
12 12
 	dockerimage "github.com/docker/docker/image"
13
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
13
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
14 14
 )
15 15
 
16 16
 // Backend is all the methods that need to be implemented
... ...
@@ -32,12 +32,12 @@ type imageBackend interface {
32 32
 
33 33
 type importExportBackend interface {
34 34
 	LoadImage(ctx context.Context, inTar io.ReadCloser, outStream io.Writer, quiet bool) error
35
-	ImportImage(ctx context.Context, ref reference.Named, platform *specs.Platform, msg string, layerReader io.Reader, changes []string) (dockerimage.ID, error)
35
+	ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (dockerimage.ID, error)
36 36
 	ExportImage(ctx context.Context, names []string, outStream io.Writer) error
37 37
 }
38 38
 
39 39
 type registryBackend interface {
40
-	PullImage(ctx context.Context, image, tag string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
40
+	PullImage(ctx context.Context, image, tag string, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
41 41
 	PushImage(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
42 42
 }
43 43
 
... ...
@@ -24,7 +24,7 @@ import (
24 24
 	"github.com/docker/docker/pkg/ioutils"
25 25
 	"github.com/docker/docker/pkg/progress"
26 26
 	"github.com/docker/docker/pkg/streamformatter"
27
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
27
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
28 28
 	"github.com/pkg/errors"
29 29
 )
30 30
 
... ...
@@ -41,7 +41,7 @@ func (ir *imageRouter) postImagesCreate(ctx context.Context, w http.ResponseWrit
41 41
 		comment     = r.Form.Get("message")
42 42
 		progressErr error
43 43
 		output      = ioutils.NewWriteFlusher(w)
44
-		platform    *specs.Platform
44
+		platform    *ocispec.Platform
45 45
 	)
46 46
 	defer output.Close()
47 47
 
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"github.com/docker/docker/api/types"
7 7
 	"github.com/docker/docker/api/types/registry"
8 8
 	"github.com/docker/docker/pkg/streamformatter"
9
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
9
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
10 10
 )
11 11
 
12 12
 // PullOption defines different modes for accessing images
... ...
@@ -42,5 +42,5 @@ type GetImageAndLayerOptions struct {
42 42
 	PullOption PullOption
43 43
 	AuthConfig map[string]registry.AuthConfig
44 44
 	Output     io.Writer
45
-	Platform   *specs.Platform
45
+	Platform   *ocispec.Platform
46 46
 }
... ...
@@ -3,7 +3,7 @@ package types // import "github.com/docker/docker/api/types"
3 3
 import (
4 4
 	"github.com/docker/docker/api/types/container"
5 5
 	"github.com/docker/docker/api/types/network"
6
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
6
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
7 7
 )
8 8
 
9 9
 // configs holds structs used for internal communication between the
... ...
@@ -16,7 +16,7 @@ type ContainerCreateConfig struct {
16 16
 	Config           *container.Config
17 17
 	HostConfig       *container.HostConfig
18 18
 	NetworkingConfig *network.NetworkingConfig
19
-	Platform         *specs.Platform
19
+	Platform         *ocispec.Platform
20 20
 	AdjustCPUShares  bool
21 21
 }
22 22
 
... ...
@@ -1,9 +1,9 @@
1 1
 package image
2 2
 
3
-import specs "github.com/opencontainers/image-spec/specs-go/v1"
3
+import ocispec "github.com/opencontainers/image-spec/specs-go/v1"
4 4
 
5 5
 // GetImageOpts holds parameters to inspect an image.
6 6
 type GetImageOpts struct {
7
-	Platform *specs.Platform
7
+	Platform *ocispec.Platform
8 8
 	Details  bool
9 9
 }
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"net"
6 6
 
7
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
7
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
8 8
 )
9 9
 
10 10
 // ServiceConfig stores daemon registry services configuration.
... ...
@@ -113,8 +113,8 @@ type SearchResults struct {
113 113
 type DistributionInspect struct {
114 114
 	// Descriptor contains information about the manifest, including
115 115
 	// the content addressable digest
116
-	Descriptor v1.Descriptor
116
+	Descriptor ocispec.Descriptor
117 117
 	// Platforms contains the list of platforms supported by the image,
118 118
 	// obtained by parsing the manifest
119
-	Platforms []v1.Platform
119
+	Platforms []ocispec.Platform
120 120
 }
... ...
@@ -18,7 +18,7 @@ import (
18 18
 	"github.com/moby/buildkit/solver"
19 19
 	"github.com/moby/buildkit/worker"
20 20
 	"github.com/opencontainers/go-digest"
21
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
21
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
22 22
 	"github.com/pkg/errors"
23 23
 )
24 24
 
... ...
@@ -26,9 +26,9 @@ import (
26 26
 func ResolveCacheImporterFunc(sm *session.Manager, resolverFunc docker.RegistryHosts, cs content.Store, rs reference.Store, is imagestore.Store) remotecache.ResolveCacheImporterFunc {
27 27
 	upstream := registryremotecache.ResolveCacheImporterFunc(sm, cs, resolverFunc)
28 28
 
29
-	return func(ctx context.Context, group session.Group, attrs map[string]string) (remotecache.Importer, specs.Descriptor, error) {
29
+	return func(ctx context.Context, group session.Group, attrs map[string]string) (remotecache.Importer, ocispec.Descriptor, error) {
30 30
 		if dt, err := tryImportLocal(rs, is, attrs["ref"]); err == nil {
31
-			return newLocalImporter(dt), specs.Descriptor{}, nil
31
+			return newLocalImporter(dt), ocispec.Descriptor{}, nil
32 32
 		}
33 33
 		return upstream(ctx, group, attrs)
34 34
 	}
... ...
@@ -59,7 +59,7 @@ type localImporter struct {
59 59
 	dt []byte
60 60
 }
61 61
 
62
-func (li *localImporter) Resolve(ctx context.Context, _ specs.Descriptor, id string, w worker.Worker) (solver.CacheManager, error) {
62
+func (li *localImporter) Resolve(ctx context.Context, _ ocispec.Descriptor, id string, w worker.Worker) (solver.CacheManager, error) {
63 63
 	cc := v1.NewCacheChains()
64 64
 	if err := li.importInlineCache(ctx, li.dt, cc); err != nil {
65 65
 		return nil, err
... ...
@@ -96,7 +96,7 @@ func (li *localImporter) importInlineCache(ctx context.Context, dt []byte, cc so
96 96
 	layers := v1.DescriptorProvider{}
97 97
 	for i, diffID := range img.Rootfs.DiffIDs {
98 98
 		dgst := digest.Digest(diffID.String())
99
-		desc := specs.Descriptor{
99
+		desc := ocispec.Descriptor{
100 100
 			Digest:      dgst,
101 101
 			Size:        -1,
102 102
 			MediaType:   images.MediaTypeDockerSchema2Layer,
... ...
@@ -157,6 +157,6 @@ func parseCreatedLayerInfo(img image) ([]string, []string, error) {
157 157
 type emptyProvider struct {
158 158
 }
159 159
 
160
-func (p *emptyProvider) ReaderAt(ctx context.Context, dec specs.Descriptor) (content.ReaderAt, error) {
160
+func (p *emptyProvider) ReaderAt(ctx context.Context, dec ocispec.Descriptor) (content.ReaderAt, error) {
161 161
 	return nil, errors.Errorf("ReaderAt not implemented for empty provider")
162 162
 }
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	"github.com/moby/buildkit/frontend/dockerfile/instructions"
22 22
 	"github.com/moby/buildkit/frontend/dockerfile/parser"
23 23
 	"github.com/moby/buildkit/frontend/dockerfile/shell"
24
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
24
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
25 25
 	"github.com/pkg/errors"
26 26
 	"github.com/sirupsen/logrus"
27 27
 	"golang.org/x/sync/syncmap"
... ...
@@ -125,7 +125,7 @@ type Builder struct {
125 125
 	pathCache        pathCache
126 126
 	containerManager *containerManager
127 127
 	imageProber      ImageProber
128
-	platform         *specs.Platform
128
+	platform         *ocispec.Platform
129 129
 }
130 130
 
131 131
 // newBuilder creates a new Dockerfile builder from an optional dockerfile and a Options.
... ...
@@ -24,7 +24,7 @@ import (
24 24
 	"github.com/docker/docker/pkg/streamformatter"
25 25
 	"github.com/docker/docker/pkg/system"
26 26
 	"github.com/moby/buildkit/frontend/dockerfile/instructions"
27
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
27
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
28 28
 	"github.com/pkg/errors"
29 29
 )
30 30
 
... ...
@@ -74,7 +74,7 @@ type copier struct {
74 74
 	source      builder.Source
75 75
 	pathCache   pathCache
76 76
 	download    sourceDownloader
77
-	platform    *specs.Platform
77
+	platform    *ocispec.Platform
78 78
 	// for cleanup. TODO: having copier.cleanup() is error prone and hard to
79 79
 	// follow. Code calling performCopy should manage the lifecycle of its params.
80 80
 	// Copier should take override source as input, not imageMount.
... ...
@@ -86,7 +86,7 @@ func copierFromDispatchRequest(req dispatchRequest, download sourceDownloader, i
86 86
 	platform := req.builder.platform
87 87
 	if platform == nil {
88 88
 		// May be nil if not explicitly set in API/dockerfile
89
-		platform = &specs.Platform{}
89
+		platform = &ocispec.Platform{}
90 90
 	}
91 91
 	if platform.OS == "" {
92 92
 		// Default to the dispatch requests operating system if not explicit in API/dockerfile
... ...
@@ -28,7 +28,7 @@ import (
28 28
 	"github.com/moby/buildkit/frontend/dockerfile/parser"
29 29
 	"github.com/moby/buildkit/frontend/dockerfile/shell"
30 30
 	"github.com/moby/sys/signal"
31
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
31
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
32 32
 	"github.com/pkg/errors"
33 33
 )
34 34
 
... ...
@@ -158,7 +158,7 @@ func initializeStage(ctx context.Context, d dispatchRequest, cmd *instructions.S
158 158
 		return err
159 159
 	}
160 160
 
161
-	var platform *specs.Platform
161
+	var platform *ocispec.Platform
162 162
 	if v := cmd.Platform; v != "" {
163 163
 		v, err := d.getExpandedString(d.shlex, v)
164 164
 		if err != nil {
... ...
@@ -232,7 +232,7 @@ func (d *dispatchRequest) getExpandedString(shlex *shell.Lex, str string) (strin
232 232
 	return name, nil
233 233
 }
234 234
 
235
-func (d *dispatchRequest) getImageOrStage(ctx context.Context, name string, platform *specs.Platform) (builder.Image, error) {
235
+func (d *dispatchRequest) getImageOrStage(ctx context.Context, name string, platform *ocispec.Platform) (builder.Image, error) {
236 236
 	var localOnly bool
237 237
 	if im, ok := d.stages.getByName(name); ok {
238 238
 		name = im.Image
... ...
@@ -266,7 +266,7 @@ func (d *dispatchRequest) getImageOrStage(ctx context.Context, name string, plat
266 266
 	return imageMount.Image(), nil
267 267
 }
268 268
 
269
-func (d *dispatchRequest) getFromImage(ctx context.Context, shlex *shell.Lex, basename string, platform *specs.Platform) (builder.Image, error) {
269
+func (d *dispatchRequest) getFromImage(ctx context.Context, shlex *shell.Lex, basename string, platform *ocispec.Platform) (builder.Image, error) {
270 270
 	name, err := d.getExpandedString(shlex, basename)
271 271
 	if err != nil {
272 272
 		return nil, err
... ...
@@ -8,12 +8,12 @@ import (
8 8
 	"github.com/docker/docker/api/types/backend"
9 9
 	"github.com/docker/docker/builder"
10 10
 	dockerimage "github.com/docker/docker/image"
11
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
11
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
12 12
 	"github.com/pkg/errors"
13 13
 	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16
-type getAndMountFunc func(context.Context, string, bool, *specs.Platform) (builder.Image, builder.ROLayer, error)
16
+type getAndMountFunc func(context.Context, string, bool, *ocispec.Platform) (builder.Image, builder.ROLayer, error)
17 17
 
18 18
 // imageSources mounts images and provides a cache for mounted images. It tracks
19 19
 // all images so they can be unmounted at the end of the build.
... ...
@@ -24,7 +24,7 @@ type imageSources struct {
24 24
 }
25 25
 
26 26
 func newImageSources(options builderOptions) *imageSources {
27
-	getAndMount := func(ctx context.Context, idOrRef string, localOnly bool, platform *specs.Platform) (builder.Image, builder.ROLayer, error) {
27
+	getAndMount := func(ctx context.Context, idOrRef string, localOnly bool, platform *ocispec.Platform) (builder.Image, builder.ROLayer, error) {
28 28
 		pullOption := backend.PullOptionNoPull
29 29
 		if !localOnly {
30 30
 			if options.Options.PullParent {
... ...
@@ -47,7 +47,7 @@ func newImageSources(options builderOptions) *imageSources {
47 47
 	}
48 48
 }
49 49
 
50
-func (m *imageSources) Get(ctx context.Context, idOrRef string, localOnly bool, platform *specs.Platform) (*imageMount, error) {
50
+func (m *imageSources) Get(ctx context.Context, idOrRef string, localOnly bool, platform *ocispec.Platform) (*imageMount, error) {
51 51
 	if im, ok := m.byImageID[idOrRef]; ok {
52 52
 		return im, nil
53 53
 	}
... ...
@@ -71,7 +71,7 @@ func (m *imageSources) Unmount() (retErr error) {
71 71
 	return
72 72
 }
73 73
 
74
-func (m *imageSources) Add(im *imageMount, platform *specs.Platform) {
74
+func (m *imageSources) Add(im *imageMount, platform *ocispec.Platform) {
75 75
 	switch im.image {
76 76
 	case nil:
77 77
 		// Set the platform for scratch images
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"github.com/docker/docker/pkg/chrootarchive"
20 20
 	"github.com/docker/docker/pkg/stringid"
21 21
 	"github.com/docker/go-connections/nat"
22
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
22
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
23 23
 	"github.com/pkg/errors"
24 24
 	"github.com/sirupsen/logrus"
25 25
 )
... ...
@@ -74,7 +74,7 @@ func (b *Builder) exportImage(state *dispatchState, layer builder.RWLayer, paren
74 74
 		return errors.Errorf("unexpected image type")
75 75
 	}
76 76
 
77
-	platform := &specs.Platform{
77
+	platform := &ocispec.Platform{
78 78
 		OS:           parentImage.OS,
79 79
 		Architecture: parentImage.Architecture,
80 80
 		Variant:      parentImage.Variant,
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"github.com/docker/docker/api/types/container"
10 10
 	"github.com/docker/docker/api/types/network"
11 11
 	"github.com/docker/docker/api/types/versions"
12
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
12
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
13 13
 )
14 14
 
15 15
 type configWrapper struct {
... ...
@@ -20,7 +20,7 @@ type configWrapper struct {
20 20
 
21 21
 // ContainerCreate creates a new container based on the given configuration.
22 22
 // It can be associated with a name, but it's not mandatory.
23
-func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.CreateResponse, error) {
23
+func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error) {
24 24
 	var response container.CreateResponse
25 25
 
26 26
 	if err := cli.NewVersionError("1.25", "stop timeout"); config != nil && config.StopTimeout != nil && err != nil {
... ...
@@ -75,7 +75,7 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config
75 75
 // Similar to containerd's platforms.Format(), but does allow components to be
76 76
 // omitted (e.g. pass "architecture" only, without "os":
77 77
 // https://github.com/containerd/containerd/blob/v1.5.2/platforms/platforms.go#L243-L263
78
-func formatPlatform(platform *specs.Platform) string {
78
+func formatPlatform(platform *ocispec.Platform) string {
79 79
 	if platform == nil {
80 80
 		return ""
81 81
 	}
... ...
@@ -15,7 +15,7 @@ import (
15 15
 	"github.com/docker/docker/api/types/registry"
16 16
 	"github.com/docker/docker/api/types/swarm"
17 17
 	"github.com/docker/docker/api/types/volume"
18
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
18
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
19 19
 )
20 20
 
21 21
 // CommonAPIClient is the common methods between stable and experimental versions of APIClient.
... ...
@@ -47,7 +47,7 @@ type CommonAPIClient interface {
47 47
 type ContainerAPIClient interface {
48 48
 	ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
49 49
 	ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error)
50
-	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.CreateResponse, error)
50
+	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *ocispec.Platform, containerName string) (container.CreateResponse, error)
51 51
 	ContainerDiff(ctx context.Context, container string) ([]container.FilesystemChange, error)
52 52
 	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
53 53
 	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
... ...
@@ -15,7 +15,7 @@ import (
15 15
 	"github.com/docker/docker/api/types/swarm"
16 16
 	"github.com/docker/docker/errdefs"
17 17
 	"github.com/opencontainers/go-digest"
18
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
18
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
19 19
 	"gotest.tools/v3/assert"
20 20
 	is "gotest.tools/v3/assert/cmp"
21 21
 )
... ...
@@ -91,10 +91,10 @@ func TestServiceCreateCompatiblePlatforms(t *testing.T) {
91 91
 				}, nil
92 92
 			} else if strings.HasPrefix(req.URL.Path, "/v1.30/distribution/") {
93 93
 				b, err := json.Marshal(registrytypes.DistributionInspect{
94
-					Descriptor: v1.Descriptor{
94
+					Descriptor: ocispec.Descriptor{
95 95
 						Digest: "sha256:c0537ff6a5218ef531ece93d4984efc99bbf3f7497c0a7726c88e2bb7584dc96",
96 96
 					},
97
-					Platforms: []v1.Platform{
97
+					Platforms: []ocispec.Platform{
98 98
 						{
99 99
 							Architecture: "amd64",
100 100
 							OS:           "linux",
... ...
@@ -171,7 +171,7 @@ func TestServiceCreateDigestPinning(t *testing.T) {
171 171
 			} else if strings.HasPrefix(req.URL.Path, "/v1.30/distribution/") {
172 172
 				// resolvable images
173 173
 				b, err := json.Marshal(registrytypes.DistributionInspect{
174
-					Descriptor: v1.Descriptor{
174
+					Descriptor: ocispec.Descriptor{
175 175
 						Digest: digest.Digest(dgst),
176 176
 					},
177 177
 				})
... ...
@@ -27,7 +27,7 @@ import (
27 27
 	"github.com/docker/docker/plugin"
28 28
 	volumeopts "github.com/docker/docker/volume/service/opts"
29 29
 	"github.com/moby/swarmkit/v2/agent/exec"
30
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
30
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
31 31
 )
32 32
 
33 33
 // Backend defines the executor component for a swarm agent.
... ...
@@ -75,7 +75,7 @@ type VolumeBackend interface {
75 75
 
76 76
 // ImageBackend is used by an executor to perform image operations
77 77
 type ImageBackend interface {
78
-	PullImage(ctx context.Context, image, tag string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
78
+	PullImage(ctx context.Context, image, tag string, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
79 79
 	GetRepository(context.Context, reference.Named, *registry.AuthConfig) (distribution.Repository, error)
80 80
 	GetImage(ctx context.Context, refOrID string, options opts.GetImageOpts) (*image.Image, error)
81 81
 }
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"github.com/moby/buildkit/util/attestation"
20 20
 	"github.com/opencontainers/go-digest"
21 21
 	"github.com/opencontainers/image-spec/identity"
22
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
22
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
23 23
 	"github.com/pkg/errors"
24 24
 	"github.com/sirupsen/logrus"
25 25
 )
... ...
@@ -87,7 +87,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
87 87
 			continue
88 88
 		}
89 89
 
90
-		err := images.Walk(ctx, images.HandlerFunc(func(ctx context.Context, desc v1.Descriptor) ([]v1.Descriptor, error) {
90
+		err := images.Walk(ctx, images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
91 91
 			if images.IsIndexType(desc.MediaType) {
92 92
 				return images.Children(ctx, contentStore, desc)
93 93
 			}
... ...
@@ -418,7 +418,7 @@ func setupLabelFilter(store content.Store, fltrs filters.Args) (func(image image
418 418
 		// processing more content (otherwise it will run for all children).
419 419
 		// It will be returned once a matching config is found.
420 420
 		errFoundConfig := errors.New("success, found matching config")
421
-		err := images.Dispatch(ctx, presentChildrenHandler(store, images.HandlerFunc(func(ctx context.Context, desc v1.Descriptor) (subdescs []v1.Descriptor, err error) {
421
+		err := images.Dispatch(ctx, presentChildrenHandler(store, images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) {
422 422
 			if !images.IsConfigType(desc.MediaType) {
423 423
 				return nil, nil
424 424
 			}
... ...
@@ -511,8 +511,8 @@ func computeSharedSize(chainIDs []digest.Digest, layers map[digest.Digest]int, s
511 511
 
512 512
 // getManifestPlatform returns a platform specified by the manifest descriptor
513 513
 // or reads it from its config.
514
-func getManifestPlatform(ctx context.Context, store content.Provider, manifestDesc, configDesc v1.Descriptor) (v1.Platform, error) {
515
-	var platform v1.Platform
514
+func getManifestPlatform(ctx context.Context, store content.Provider, manifestDesc, configDesc ocispec.Descriptor) (ocispec.Platform, error) {
515
+	var platform ocispec.Platform
516 516
 	if manifestDesc.Platform != nil {
517 517
 		platform = *manifestDesc.Platform
518 518
 	} else {
... ...
@@ -527,7 +527,7 @@ func getManifestPlatform(ctx context.Context, store content.Provider, manifestDe
527 527
 
528 528
 // isImageManifest returns true if the manifest has any layer that is a known image layer.
529 529
 // Some manifests use the image media type for compatibility, even if they are not a real image.
530
-func isImageManifest(mfst v1.Manifest) bool {
530
+func isImageManifest(mfst ocispec.Manifest) bool {
531 531
 	for _, l := range mfst.Layers {
532 532
 		if images.IsLayerType(l.MediaType) {
533 533
 			return true
... ...
@@ -537,7 +537,7 @@ func isImageManifest(mfst v1.Manifest) bool {
537 537
 }
538 538
 
539 539
 // readConfig reads content pointed by the descriptor and unmarshals it into a specified output.
540
-func readConfig(ctx context.Context, store content.Provider, desc v1.Descriptor, out interface{}) error {
540
+func readConfig(ctx context.Context, store content.Provider, desc ocispec.Descriptor, out interface{}) error {
541 541
 	data, err := content.ReadBlob(ctx, store, desc)
542 542
 	if err != nil {
543 543
 		return errors.Wrapf(err, "failed to read config content")
... ...
@@ -14,13 +14,13 @@ import (
14 14
 	"github.com/docker/docker/errdefs"
15 15
 	"github.com/docker/docker/pkg/streamformatter"
16 16
 	"github.com/opencontainers/go-digest"
17
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
17
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
18 18
 	"github.com/sirupsen/logrus"
19 19
 )
20 20
 
21 21
 // PullImage initiates a pull operation. image is the repository name to pull, and
22 22
 // tagOrDigest may be either empty, or indicate a specific tag or digest to pull.
23
-func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
23
+func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
24 24
 	var opts []containerd.RemoteOpt
25 25
 	if platform != nil {
26 26
 		opts = append(opts, containerd.WithPlatform(platforms.Format(*platform)))
... ...
@@ -49,7 +49,7 @@ func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string,
49 49
 	opts = append(opts, containerd.WithResolver(resolver))
50 50
 
51 51
 	jobs := newJobs()
52
-	h := images.HandlerFunc(func(ctx context.Context, desc specs.Descriptor) ([]specs.Descriptor, error) {
52
+	h := images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
53 53
 		if desc.MediaType != images.MediaTypeDockerSchema1Manifest {
54 54
 			jobs.Add(desc)
55 55
 		}
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"github.com/containerd/containerd/leases"
8 8
 	"github.com/containerd/containerd/platforms"
9 9
 	"github.com/opencontainers/image-spec/identity"
10
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
10
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
11 11
 )
12 12
 
13 13
 // PrepareSnapshot prepares a snapshot from a parent image for a container
14
-func (i *ImageService) PrepareSnapshot(ctx context.Context, id string, parentImage string, platform *v1.Platform) error {
14
+func (i *ImageService) PrepareSnapshot(ctx context.Context, id string, parentImage string, platform *ocispec.Platform) error {
15 15
 	desc, err := i.resolveDescriptor(ctx, parentImage)
16 16
 	if err != nil {
17 17
 		return err
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"github.com/docker/docker/image"
20 20
 	"github.com/docker/docker/pkg/idtools"
21 21
 	"github.com/docker/docker/runconfig"
22
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
22
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
23 23
 	"github.com/opencontainers/selinux/go-selinux"
24 24
 	"github.com/pkg/errors"
25 25
 	"github.com/sirupsen/logrus"
... ...
@@ -74,7 +74,7 @@ func (daemon *Daemon) containerCreate(ctx context.Context, opts createOpts) (con
74 74
 		}
75 75
 		if img != nil {
76 76
 			p := maximumSpec()
77
-			imgPlat := v1.Platform{
77
+			imgPlat := ocispec.Platform{
78 78
 				OS:           img.OS,
79 79
 				Architecture: img.Architecture,
80 80
 				Variant:      img.Variant,
... ...
@@ -117,7 +117,7 @@ func (daemon *Daemon) create(ctx context.Context, opts createOpts) (retC *contai
117 117
 	var (
118 118
 		ctr         *container.Container
119 119
 		img         *image.Image
120
-		imgManifest *v1.Descriptor
120
+		imgManifest *ocispec.Descriptor
121 121
 		imgID       image.ID
122 122
 		err         error
123 123
 		os          = runtime.GOOS
... ...
@@ -345,7 +345,7 @@ func verifyNetworkingConfig(nwConfig *networktypes.NetworkingConfig) error {
345 345
 }
346 346
 
347 347
 // maximumSpec returns the distribution platform with maximum compatibility for the current node.
348
-func maximumSpec() v1.Platform {
348
+func maximumSpec() ocispec.Platform {
349 349
 	p := platforms.DefaultSpec()
350 350
 	if p.Architecture == "amd64" {
351 351
 		p.Variant = archvariant.AMD64Variant()
... ...
@@ -16,7 +16,7 @@ import (
16 16
 	"github.com/docker/docker/image"
17 17
 	"github.com/docker/docker/layer"
18 18
 	"github.com/docker/docker/pkg/archive"
19
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
19
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
20 20
 )
21 21
 
22 22
 // ImageService is a temporary interface to assist in the migration to the
... ...
@@ -25,7 +25,7 @@ import (
25 25
 type ImageService interface {
26 26
 	// Images
27 27
 
28
-	PullImage(ctx context.Context, name, tag string, platform *v1.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
28
+	PullImage(ctx context.Context, name, tag string, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
29 29
 	PushImage(ctx context.Context, ref reference.Named, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error
30 30
 	CreateImage(config []byte, parent string) (builder.Image, error)
31 31
 	ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]types.ImageDeleteResponseItem, error)
... ...
@@ -36,7 +36,7 @@ type ImageService interface {
36 36
 	LogImageEvent(imageID, refName, action string)
37 37
 	CountImages() int
38 38
 	ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error)
39
-	ImportImage(ctx context.Context, ref reference.Named, platform *v1.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error)
39
+	ImportImage(ctx context.Context, ref reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error)
40 40
 	TagImage(ctx context.Context, imageID image.ID, newTag reference.Named) error
41 41
 	GetImage(ctx context.Context, refOrID string, options imagetype.GetImageOpts) (*image.Image, error)
42 42
 	ImageHistory(ctx context.Context, name string) ([]*imagetype.HistoryResponseItem, error)
... ...
@@ -45,8 +45,8 @@ type ImageService interface {
45 45
 
46 46
 	// Containerd related methods
47 47
 
48
-	PrepareSnapshot(ctx context.Context, id string, image string, platform *v1.Platform) error
49
-	GetImageManifest(ctx context.Context, refOrID string, options imagetype.GetImageOpts) (*v1.Descriptor, error)
48
+	PrepareSnapshot(ctx context.Context, id string, image string, platform *ocispec.Platform) error
49
+	GetImageManifest(ctx context.Context, refOrID string, options imagetype.GetImageOpts) (*ocispec.Descriptor, error)
50 50
 
51 51
 	// Layers
52 52
 
... ...
@@ -17,8 +17,7 @@ import (
17 17
 	"github.com/docker/docker/image"
18 18
 	"github.com/docker/docker/layer"
19 19
 	"github.com/opencontainers/go-digest"
20
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
21
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
20
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
22 21
 	"github.com/pkg/errors"
23 22
 	"github.com/sirupsen/logrus"
24 23
 )
... ...
@@ -40,19 +39,19 @@ func (e ErrImageDoesNotExist) Error() string {
40 40
 func (e ErrImageDoesNotExist) NotFound() {}
41 41
 
42 42
 type manifestList struct {
43
-	Manifests []specs.Descriptor `json:"manifests"`
43
+	Manifests []ocispec.Descriptor `json:"manifests"`
44 44
 }
45 45
 
46 46
 type manifest struct {
47
-	Config specs.Descriptor `json:"config"`
47
+	Config ocispec.Descriptor `json:"config"`
48 48
 }
49 49
 
50
-func (i *ImageService) PrepareSnapshot(ctx context.Context, id string, image string, platform *v1.Platform) error {
50
+func (i *ImageService) PrepareSnapshot(ctx context.Context, id string, image string, platform *ocispec.Platform) error {
51 51
 	// Only makes sense when conatinerd image store is used
52 52
 	panic("not implemented")
53 53
 }
54 54
 
55
-func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.Image, platform specs.Platform) (bool, error) {
55
+func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.Image, platform ocispec.Platform) (bool, error) {
56 56
 	logger := logrus.WithField("image", img.ID).WithField("desiredPlatform", platforms.Format(platform))
57 57
 
58 58
 	ls, leaseErr := i.leases.ListResources(ctx, leases.Lease{ID: imageKey(img.ID().String())})
... ...
@@ -81,7 +80,7 @@ func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.I
81 81
 			continue
82 82
 		}
83 83
 
84
-		ra, err := i.content.ReaderAt(ctx, specs.Descriptor{Digest: digest.Digest(r.ID)})
84
+		ra, err := i.content.ReaderAt(ctx, ocispec.Descriptor{Digest: digest.Digest(r.ID)})
85 85
 		if err != nil {
86 86
 			if cerrdefs.IsNotFound(err) {
87 87
 				continue
... ...
@@ -107,12 +106,12 @@ func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.I
107 107
 
108 108
 		for _, md := range ml.Manifests {
109 109
 			switch md.MediaType {
110
-			case specs.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
110
+			case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
111 111
 			default:
112 112
 				continue
113 113
 			}
114 114
 
115
-			p := specs.Platform{
115
+			p := ocispec.Platform{
116 116
 				Architecture: md.Platform.Architecture,
117 117
 				OS:           md.Platform.OS,
118 118
 				Variant:      md.Platform.Variant,
... ...
@@ -124,7 +123,7 @@ func (i *ImageService) manifestMatchesPlatform(ctx context.Context, img *image.I
124 124
 
125 125
 			// Here we have a platform match for the referenced manifest, let's make sure the manifest is actually for the image config we are using.
126 126
 
127
-			ra, err := i.content.ReaderAt(ctx, specs.Descriptor{Digest: md.Digest})
127
+			ra, err := i.content.ReaderAt(ctx, ocispec.Descriptor{Digest: md.Digest})
128 128
 			if err != nil {
129 129
 				logger.WithField("otherDigest", md.Digest).WithError(err).Error("Could not get reader for manifest")
130 130
 				continue
... ...
@@ -192,7 +191,7 @@ func (i *ImageService) GetImage(ctx context.Context, refOrID string, options ima
192 192
 	return img, nil
193 193
 }
194 194
 
195
-func (i *ImageService) GetImageManifest(ctx context.Context, refOrID string, options imagetypes.GetImageOpts) (*v1.Descriptor, error) {
195
+func (i *ImageService) GetImageManifest(ctx context.Context, refOrID string, options imagetypes.GetImageOpts) (*ocispec.Descriptor, error) {
196 196
 	panic("not implemented")
197 197
 }
198 198
 
... ...
@@ -202,7 +201,7 @@ func (i *ImageService) getImage(ctx context.Context, refOrID string, options ima
202 202
 			return
203 203
 		}
204 204
 
205
-		imgPlat := specs.Platform{
205
+		imgPlat := ocispec.Platform{
206 206
 			OS:           retImg.OS,
207 207
 			Architecture: retImg.Architecture,
208 208
 			Variant:      retImg.Variant,
... ...
@@ -272,16 +271,16 @@ func (i *ImageService) getImage(ctx context.Context, refOrID string, options ima
272 272
 // The reason for this is that CPU variant is not even if the official image config spec as of this writing.
273 273
 // See: https://github.com/opencontainers/image-spec/pull/809
274 274
 // Since Docker tends to compare platforms from the image config, we need to handle this case.
275
-func OnlyPlatformWithFallback(p specs.Platform) platforms.Matcher {
275
+func OnlyPlatformWithFallback(p ocispec.Platform) platforms.Matcher {
276 276
 	return &onlyFallbackMatcher{only: platforms.Only(p), p: platforms.Normalize(p)}
277 277
 }
278 278
 
279 279
 type onlyFallbackMatcher struct {
280 280
 	only platforms.Matcher
281
-	p    specs.Platform
281
+	p    ocispec.Platform
282 282
 }
283 283
 
284
-func (m *onlyFallbackMatcher) Match(other specs.Platform) bool {
284
+func (m *onlyFallbackMatcher) Match(other ocispec.Platform) bool {
285 285
 	if m.only.Match(other) {
286 286
 		// It matches, no reason to fallback
287 287
 		return true
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"github.com/docker/docker/pkg/stringid"
20 20
 	"github.com/docker/docker/pkg/system"
21 21
 	registrypkg "github.com/docker/docker/registry"
22
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
22
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
23 23
 	"github.com/pkg/errors"
24 24
 	"github.com/sirupsen/logrus"
25 25
 )
... ...
@@ -144,7 +144,7 @@ func newROLayerForImage(img *image.Image, layerStore layer.Store) (builder.ROLay
144 144
 }
145 145
 
146 146
 // TODO: could this use the regular daemon PullImage ?
147
-func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConfigs map[string]registry.AuthConfig, output io.Writer, platform *specs.Platform) (*image.Image, error) {
147
+func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConfigs map[string]registry.AuthConfig, output io.Writer, platform *ocispec.Platform) (*image.Image, error) {
148 148
 	ref, err := reference.ParseNormalizedNamed(name)
149 149
 	if err != nil {
150 150
 		return nil, err
... ...
@@ -169,7 +169,7 @@ func (i *ImageService) pullForBuilder(ctx context.Context, name string, authConf
169 169
 
170 170
 	img, err := i.GetImage(ctx, name, imagetypes.GetImageOpts{Platform: platform})
171 171
 	if errdefs.IsNotFound(err) && img != nil && platform != nil {
172
-		imgPlat := specs.Platform{
172
+		imgPlat := ocispec.Platform{
173 173
 			OS:           img.OS,
174 174
 			Architecture: img.BaseImgArch(),
175 175
 			Variant:      img.BaseImgVariant(),
... ...
@@ -16,7 +16,7 @@ import (
16 16
 	"github.com/docker/docker/layer"
17 17
 	"github.com/docker/docker/pkg/archive"
18 18
 	"github.com/docker/docker/pkg/system"
19
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
19
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
20 20
 )
21 21
 
22 22
 // ImportImage imports an image, getting the archived layer data from layerReader.
... ...
@@ -26,7 +26,7 @@ import (
26 26
 // If the platform is nil, the default host platform is used.
27 27
 // Message is used as the image's history comment.
28 28
 // Image configuration is derived from the dockerfile instructions in changes.
29
-func (i *ImageService) ImportImage(ctx context.Context, newRef reference.Named, platform *specs.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error) {
29
+func (i *ImageService) ImportImage(ctx context.Context, newRef reference.Named, platform *ocispec.Platform, msg string, layerReader io.Reader, changes []string) (image.ID, error) {
30 30
 	if platform == nil {
31 31
 		def := platforms.DefaultSpec()
32 32
 		platform = &def
... ...
@@ -17,14 +17,14 @@ import (
17 17
 	"github.com/docker/docker/pkg/progress"
18 18
 	"github.com/docker/docker/pkg/streamformatter"
19 19
 	"github.com/opencontainers/go-digest"
20
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
20
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
21 21
 	"github.com/pkg/errors"
22 22
 	"github.com/sirupsen/logrus"
23 23
 )
24 24
 
25 25
 // PullImage initiates a pull operation. image is the repository name to pull, and
26 26
 // tag may be either empty, or indicate a specific tag to pull.
27
-func (i *ImageService) PullImage(ctx context.Context, image, tag string, platform *specs.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
27
+func (i *ImageService) PullImage(ctx context.Context, image, tag string, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
28 28
 	start := time.Now()
29 29
 	// Special case: "pull -a" may send an image name with a
30 30
 	// trailing :. This is ugly, but let's not break API
... ...
@@ -79,7 +79,7 @@ func (i *ImageService) PullImage(ctx context.Context, image, tag string, platfor
79 79
 	return nil
80 80
 }
81 81
 
82
-func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference.Named, platform *specs.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
82
+func (i *ImageService) pullImageWithReference(ctx context.Context, ref reference.Named, platform *ocispec.Platform, metaHeaders map[string][]string, authConfig *registry.AuthConfig, outStream io.Writer) error {
83 83
 	// Include a buffer so that slow client connections don't affect
84 84
 	// transfer performance.
85 85
 	progressChan := make(chan progress.Progress, 100)
... ...
@@ -3,30 +3,30 @@ package images
3 3
 import (
4 4
 	"testing"
5 5
 
6
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
6
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
7 7
 	"gotest.tools/v3/assert"
8 8
 )
9 9
 
10 10
 func TestOnlyPlatformWithFallback(t *testing.T) {
11
-	p := specs.Platform{
11
+	p := ocispec.Platform{
12 12
 		OS:           "linux",
13 13
 		Architecture: "arm",
14 14
 		Variant:      "v8",
15 15
 	}
16 16
 
17 17
 	// Check no variant
18
-	assert.Assert(t, OnlyPlatformWithFallback(p).Match(specs.Platform{
18
+	assert.Assert(t, OnlyPlatformWithFallback(p).Match(ocispec.Platform{
19 19
 		OS:           p.OS,
20 20
 		Architecture: p.Architecture,
21 21
 	}))
22 22
 	// check with variant
23
-	assert.Assert(t, OnlyPlatformWithFallback(p).Match(specs.Platform{
23
+	assert.Assert(t, OnlyPlatformWithFallback(p).Match(ocispec.Platform{
24 24
 		OS:           p.OS,
25 25
 		Architecture: p.Architecture,
26 26
 		Variant:      p.Variant,
27 27
 	}))
28 28
 	// Make sure non-matches are false.
29
-	assert.Assert(t, !OnlyPlatformWithFallback(p).Match(specs.Platform{
29
+	assert.Assert(t, !OnlyPlatformWithFallback(p).Match(ocispec.Platform{
30 30
 		OS:           p.OS,
31 31
 		Architecture: "amd64",
32 32
 	}))
... ...
@@ -14,7 +14,7 @@ import (
14 14
 	"github.com/containerd/containerd/namespaces"
15 15
 	"github.com/docker/docker/image"
16 16
 	"github.com/opencontainers/go-digest"
17
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
17
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
18 18
 	"go.etcd.io/bbolt"
19 19
 	"gotest.tools/v3/assert"
20 20
 	is "gotest.tools/v3/assert/cmp"
... ...
@@ -96,7 +96,7 @@ func TestContentStoreForPull(t *testing.T) {
96 96
 	}
97 97
 
98 98
 	data := []byte(`{}`)
99
-	desc := v1.Descriptor{
99
+	desc := ocispec.Descriptor{
100 100
 		Digest: digest.Canonical.FromBytes(data),
101 101
 		Size:   int64(len(data)),
102 102
 	}
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	refstore "github.com/docker/docker/reference"
20 20
 	registrypkg "github.com/docker/docker/registry"
21 21
 	"github.com/opencontainers/go-digest"
22
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
22
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
23 23
 	"github.com/pkg/errors"
24 24
 )
25 25
 
... ...
@@ -60,7 +60,7 @@ type ImagePullConfig struct {
60 60
 	// types is used.
61 61
 	Schema2Types []string
62 62
 	// Platform is the requested platform of the image being pulled
63
-	Platform *specs.Platform
63
+	Platform *ocispec.Platform
64 64
 }
65 65
 
66 66
 // ImagePushConfig stores push configuration.
... ...
@@ -141,7 +141,7 @@ func rootFSFromConfig(c []byte) (*image.RootFS, error) {
141 141
 	return unmarshalledConfig.RootFS, nil
142 142
 }
143 143
 
144
-func platformFromConfig(c []byte) (*specs.Platform, error) {
144
+func platformFromConfig(c []byte) (*ocispec.Platform, error) {
145 145
 	var unmarshalledConfig image.Image
146 146
 	if err := json.Unmarshal(c, &unmarshalledConfig); err != nil {
147 147
 		return nil, err
... ...
@@ -154,7 +154,7 @@ func platformFromConfig(c []byte) (*specs.Platform, error) {
154 154
 	if !system.IsOSSupported(os) {
155 155
 		return nil, errors.Wrapf(system.ErrNotSupportedOperatingSystem, "image operating system %q cannot be used on this platform", os)
156 156
 	}
157
-	return &specs.Platform{
157
+	return &ocispec.Platform{
158 158
 		OS:           os,
159 159
 		Architecture: unmarshalledConfig.Architecture,
160 160
 		Variant:      unmarshalledConfig.Variant,
... ...
@@ -18,7 +18,7 @@ import (
18 18
 	"github.com/docker/distribution/reference"
19 19
 	"github.com/docker/docker/registry"
20 20
 	"github.com/opencontainers/go-digest"
21
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
21
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
22 22
 	"github.com/pkg/errors"
23 23
 	"github.com/sirupsen/logrus"
24 24
 )
... ...
@@ -97,7 +97,7 @@ func hasDistributionSource(label, repo string) bool {
97 97
 	return false
98 98
 }
99 99
 
100
-func (m *manifestStore) getLocal(ctx context.Context, desc specs.Descriptor, ref reference.Named) (distribution.Manifest, error) {
100
+func (m *manifestStore) getLocal(ctx context.Context, desc ocispec.Descriptor, ref reference.Named) (distribution.Manifest, error) {
101 101
 	ra, err := m.local.ReaderAt(ctx, desc)
102 102
 	if err != nil {
103 103
 		return nil, errors.Wrap(err, "error getting content store reader")
... ...
@@ -153,7 +153,7 @@ func (m *manifestStore) getLocal(ctx context.Context, desc specs.Descriptor, ref
153 153
 	return manifest, nil
154 154
 }
155 155
 
156
-func (m *manifestStore) getMediaType(ctx context.Context, desc specs.Descriptor) (string, error) {
156
+func (m *manifestStore) getMediaType(ctx context.Context, desc ocispec.Descriptor) (string, error) {
157 157
 	ra, err := m.local.ReaderAt(ctx, desc)
158 158
 	if err != nil {
159 159
 		return "", errors.Wrap(err, "error getting reader to detect media type")
... ...
@@ -167,7 +167,7 @@ func (m *manifestStore) getMediaType(ctx context.Context, desc specs.Descriptor)
167 167
 	return mt, nil
168 168
 }
169 169
 
170
-func (m *manifestStore) Get(ctx context.Context, desc specs.Descriptor, ref reference.Named) (distribution.Manifest, error) {
170
+func (m *manifestStore) Get(ctx context.Context, desc ocispec.Descriptor, ref reference.Named) (distribution.Manifest, error) {
171 171
 	l := log.G(ctx)
172 172
 
173 173
 	if desc.MediaType == "" {
... ...
@@ -227,7 +227,7 @@ func (m *manifestStore) Get(ctx context.Context, desc specs.Descriptor, ref refe
227 227
 	return manifest, nil
228 228
 }
229 229
 
230
-func (m *manifestStore) Put(ctx context.Context, manifest distribution.Manifest, desc specs.Descriptor, w content.Writer, ref reference.Named) error {
230
+func (m *manifestStore) Put(ctx context.Context, manifest distribution.Manifest, desc ocispec.Descriptor, w content.Writer, ref reference.Named) error {
231 231
 	mt, payload, err := manifest.Payload()
232 232
 	if err != nil {
233 233
 		return err
... ...
@@ -282,12 +282,12 @@ func detectManifestBlobMediaType(dt []byte) (string, error) {
282 282
 	// So pretty much if we don't have a media type we can fall back to OCI.
283 283
 	// This does have a special fallback for schema1 manifests just because it is easy to detect.
284 284
 	switch mfst.MediaType {
285
-	case schema2.MediaTypeManifest, specs.MediaTypeImageManifest:
285
+	case schema2.MediaTypeManifest, ocispec.MediaTypeImageManifest:
286 286
 		if mfst.Manifests != nil || mfst.FSLayers != nil {
287 287
 			return "", fmt.Errorf(`media-type: %q should not have "manifests" or "fsLayers"`, mfst.MediaType)
288 288
 		}
289 289
 		return mfst.MediaType, nil
290
-	case manifestlist.MediaTypeManifestList, specs.MediaTypeImageIndex:
290
+	case manifestlist.MediaTypeManifestList, ocispec.MediaTypeImageIndex:
291 291
 		if mfst.Config != nil || mfst.Layers != nil || mfst.FSLayers != nil {
292 292
 			return "", fmt.Errorf(`media-type: %q should not have "config", "layers", or "fsLayers"`, mfst.MediaType)
293 293
 		}
... ...
@@ -307,10 +307,10 @@ func detectManifestBlobMediaType(dt []byte) (string, error) {
307 307
 		return schema1.MediaTypeManifest, nil
308 308
 	case mfst.Config != nil && mfst.Manifests == nil && mfst.FSLayers == nil,
309 309
 		mfst.Layers != nil && mfst.Manifests == nil && mfst.FSLayers == nil:
310
-		return specs.MediaTypeImageManifest, nil
310
+		return ocispec.MediaTypeImageManifest, nil
311 311
 	case mfst.Config == nil && mfst.Layers == nil && mfst.FSLayers == nil:
312 312
 		// fallback to index
313
-		return specs.MediaTypeImageIndex, nil
313
+		return ocispec.MediaTypeImageIndex, nil
314 314
 	}
315 315
 	return "", errors.New("media-type: cannot determine")
316 316
 }
... ...
@@ -20,7 +20,7 @@ import (
20 20
 	"github.com/docker/distribution/reference"
21 21
 	"github.com/google/go-cmp/cmp/cmpopts"
22 22
 	"github.com/opencontainers/go-digest"
23
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
23
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
24 24
 	"github.com/pkg/errors"
25 25
 	"gotest.tools/v3/assert"
26 26
 	"gotest.tools/v3/assert/cmp"
... ...
@@ -128,12 +128,12 @@ func (w *testingContentWriterWrapper) Commit(ctx context.Context, size int64, dg
128 128
 }
129 129
 
130 130
 func TestManifestStore(t *testing.T) {
131
-	ociManifest := &specs.Manifest{}
131
+	ociManifest := &ocispec.Manifest{}
132 132
 	serialized, err := json.Marshal(ociManifest)
133 133
 	assert.NilError(t, err)
134 134
 	dgst := digest.Canonical.FromBytes(serialized)
135 135
 
136
-	setupTest := func(t *testing.T) (reference.Named, specs.Descriptor, *mockManifestGetter, *manifestStore, content.Store, func(*testing.T)) {
136
+	setupTest := func(t *testing.T) (reference.Named, ocispec.Descriptor, *mockManifestGetter, *manifestStore, content.Store, func(*testing.T)) {
137 137
 		root, err := os.MkdirTemp("", strings.ReplaceAll(t.Name(), "/", "_"))
138 138
 		assert.NilError(t, err)
139 139
 		defer func() {
... ...
@@ -147,7 +147,7 @@ func TestManifestStore(t *testing.T) {
147 147
 
148 148
 		mg := &mockManifestGetter{manifests: make(map[digest.Digest]distribution.Manifest)}
149 149
 		store := &manifestStore{local: cs, remote: mg}
150
-		desc := specs.Descriptor{Digest: dgst, MediaType: specs.MediaTypeImageManifest, Size: int64(len(serialized))}
150
+		desc := ocispec.Descriptor{Digest: dgst, MediaType: ocispec.MediaTypeImageManifest, Size: int64(len(serialized))}
151 151
 
152 152
 		ref, err := reference.Parse("foo/bar")
153 153
 		assert.NilError(t, err)
... ...
@@ -159,10 +159,10 @@ func TestManifestStore(t *testing.T) {
159 159
 
160 160
 	ctx := context.Background()
161 161
 
162
-	m, _, err := distribution.UnmarshalManifest(specs.MediaTypeImageManifest, serialized)
162
+	m, _, err := distribution.UnmarshalManifest(ocispec.MediaTypeImageManifest, serialized)
163 163
 	assert.NilError(t, err)
164 164
 
165
-	writeManifest := func(t *testing.T, cs ContentStore, desc specs.Descriptor, opts ...content.Opt) {
165
+	writeManifest := func(t *testing.T, cs ContentStore, desc ocispec.Descriptor, opts ...content.Opt) {
166 166
 		ingestKey := remotes.MakeRefKey(ctx, desc)
167 167
 		w, err := cs.Writer(ctx, content.WithDescriptor(desc), content.WithRef(ingestKey))
168 168
 		assert.NilError(t, err)
... ...
@@ -185,7 +185,7 @@ func TestManifestStore(t *testing.T) {
185 185
 	}
186 186
 
187 187
 	// All tests should end up with no active ingest
188
-	checkIngest := func(t *testing.T, cs content.Store, desc specs.Descriptor) {
188
+	checkIngest := func(t *testing.T, cs content.Store, desc ocispec.Descriptor) {
189 189
 		ingestKey := remotes.MakeRefKey(ctx, desc)
190 190
 		_, err := cs.Status(ctx, ingestKey)
191 191
 		assert.Check(t, cerrdefs.IsNotFound(err), err)
... ...
@@ -354,9 +354,9 @@ func TestDetectManifestBlobMediaType(t *testing.T) {
354 354
 	}
355 355
 	cases := map[string]testCase{
356 356
 		"mediaType is set":   {[]byte(`{"mediaType": "bananas"}`), "bananas"},
357
-		"oci manifest":       {[]byte(`{"config": {}}`), specs.MediaTypeImageManifest},
357
+		"oci manifest":       {[]byte(`{"config": {}}`), ocispec.MediaTypeImageManifest},
358 358
 		"schema1":            {[]byte(`{"fsLayers": []}`), schema1.MediaTypeManifest},
359
-		"oci index fallback": {[]byte(`{}`), specs.MediaTypeImageIndex},
359
+		"oci index fallback": {[]byte(`{}`), ocispec.MediaTypeImageIndex},
360 360
 		// Make sure we prefer mediaType
361 361
 		"mediaType and config set":   {[]byte(`{"mediaType": "bananas", "config": {}}`), "bananas"},
362 362
 		"mediaType and fsLayers set": {[]byte(`{"mediaType": "bananas", "fsLayers": []}`), "bananas"},
... ...
@@ -394,7 +394,7 @@ func TestDetectManifestBlobMediaTypeInvalid(t *testing.T) {
394 394
 			`media-type: "application/vnd.docker.distribution.manifest.v2+json" should not have "manifests" or "fsLayers"`,
395 395
 		},
396 396
 		"oci manifest mediaType with manifests": {
397
-			[]byte(`{"mediaType": "` + specs.MediaTypeImageManifest + `","manifests":[]}`),
397
+			[]byte(`{"mediaType": "` + ocispec.MediaTypeImageManifest + `","manifests":[]}`),
398 398
 			`media-type: "application/vnd.oci.image.manifest.v1+json" should not have "manifests" or "fsLayers"`,
399 399
 		},
400 400
 		"manifest list mediaType with fsLayers": {
... ...
@@ -402,11 +402,11 @@ func TestDetectManifestBlobMediaTypeInvalid(t *testing.T) {
402 402
 			`media-type: "application/vnd.docker.distribution.manifest.list.v2+json" should not have "config", "layers", or "fsLayers"`,
403 403
 		},
404 404
 		"index mediaType with layers": {
405
-			[]byte(`{"mediaType": "` + specs.MediaTypeImageIndex + `","layers":[]}`),
405
+			[]byte(`{"mediaType": "` + ocispec.MediaTypeImageIndex + `","layers":[]}`),
406 406
 			`media-type: "application/vnd.oci.image.index.v1+json" should not have "config", "layers", or "fsLayers"`,
407 407
 		},
408 408
 		"index mediaType with config": {
409
-			[]byte(`{"mediaType": "` + specs.MediaTypeImageIndex + `","config":{}}`),
409
+			[]byte(`{"mediaType": "` + ocispec.MediaTypeImageIndex + `","config":{}}`),
410 410
 			`media-type: "application/vnd.oci.image.index.v1+json" should not have "config", "layers", or "fsLayers"`,
411 411
 		},
412 412
 		"config and manifests": {
... ...
@@ -31,7 +31,7 @@ import (
31 31
 	refstore "github.com/docker/docker/reference"
32 32
 	"github.com/docker/docker/registry"
33 33
 	"github.com/opencontainers/go-digest"
34
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
34
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
35 35
 	"github.com/pkg/errors"
36 36
 	"github.com/sirupsen/logrus"
37 37
 	archvariant "github.com/tonistiigi/go-archvariant"
... ...
@@ -348,7 +348,7 @@ func (ld *layerDescriptor) Registered(diffID layer.DiffID) {
348 348
 	_ = ld.metadataService.Add(diffID, metadata.V2Metadata{Digest: ld.digest, SourceRepository: ld.repoInfo.Name.Name()})
349 349
 }
350 350
 
351
-func (p *puller) pullTag(ctx context.Context, ref reference.Named, platform *specs.Platform) (tagUpdated bool, err error) {
351
+func (p *puller) pullTag(ctx context.Context, ref reference.Named, platform *ocispec.Platform) (tagUpdated bool, err error) {
352 352
 	var (
353 353
 		tagOrDigest string // Used for logging/progress only
354 354
 		dgst        digest.Digest
... ...
@@ -381,7 +381,7 @@ func (p *puller) pullTag(ctx context.Context, ref reference.Named, platform *spe
381 381
 			"remote": ref,
382 382
 		}))
383 383
 
384
-	desc := specs.Descriptor{
384
+	desc := ocispec.Descriptor{
385 385
 		MediaType: mt,
386 386
 		Digest:    dgst,
387 387
 		Size:      size,
... ...
@@ -519,7 +519,7 @@ func (p *puller) validateMediaType(mediaType string) error {
519 519
 	return invalidManifestClassError{mediaType, configClass}
520 520
 }
521 521
 
522
-func (p *puller) pullSchema1(ctx context.Context, ref reference.Reference, unverifiedManifest *schema1.SignedManifest, platform *specs.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
522
+func (p *puller) pullSchema1(ctx context.Context, ref reference.Reference, unverifiedManifest *schema1.SignedManifest, platform *ocispec.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
523 523
 	if platform != nil {
524 524
 		// Early bath if the requested OS doesn't match that of the configuration.
525 525
 		// This avoids doing the download, only to potentially fail later.
... ...
@@ -616,7 +616,7 @@ func checkSupportedMediaType(mediaType string) error {
616 616
 	return unsupportedMediaTypeError{MediaType: mediaType}
617 617
 }
618 618
 
619
-func (p *puller) pullSchema2Layers(ctx context.Context, target distribution.Descriptor, layers []distribution.Descriptor, platform *specs.Platform) (id digest.Digest, err error) {
619
+func (p *puller) pullSchema2Layers(ctx context.Context, target distribution.Descriptor, layers []distribution.Descriptor, platform *ocispec.Platform) (id digest.Digest, err error) {
620 620
 	if _, err := p.config.ImageStore.Get(ctx, target.Digest); err == nil {
621 621
 		// If the image already exists locally, no need to pull
622 622
 		// anything.
... ...
@@ -669,11 +669,11 @@ func (p *puller) pullSchema2Layers(ctx context.Context, target distribution.Desc
669 669
 	}()
670 670
 
671 671
 	var (
672
-		configJSON       []byte          // raw serialized image config
673
-		downloadedRootFS *image.RootFS   // rootFS from registered layers
674
-		configRootFS     *image.RootFS   // rootFS from configuration
675
-		release          func()          // release resources from rootFS download
676
-		configPlatform   *specs.Platform // for LCOW when registering downloaded layers
672
+		configJSON       []byte            // raw serialized image config
673
+		downloadedRootFS *image.RootFS     // rootFS from registered layers
674
+		configRootFS     *image.RootFS     // rootFS from configuration
675
+		release          func()            // release resources from rootFS download
676
+		configPlatform   *ocispec.Platform // for LCOW when registering downloaded layers
677 677
 	)
678 678
 
679 679
 	layerStoreOS := runtime.GOOS
... ...
@@ -798,7 +798,7 @@ func (p *puller) pullSchema2Layers(ctx context.Context, target distribution.Desc
798 798
 	return imageID, nil
799 799
 }
800 800
 
801
-func (p *puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *schema2.DeserializedManifest, platform *specs.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
801
+func (p *puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *schema2.DeserializedManifest, platform *ocispec.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
802 802
 	manifestDigest, err = schema2ManifestDigest(ref, mfst)
803 803
 	if err != nil {
804 804
 		return "", "", err
... ...
@@ -807,7 +807,7 @@ func (p *puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *sch
807 807
 	return id, manifestDigest, err
808 808
 }
809 809
 
810
-func (p *puller) pullOCI(ctx context.Context, ref reference.Named, mfst *ocischema.DeserializedManifest, platform *specs.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
810
+func (p *puller) pullOCI(ctx context.Context, ref reference.Named, mfst *ocischema.DeserializedManifest, platform *ocispec.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
811 811
 	manifestDigest, err = schema2ManifestDigest(ref, mfst)
812 812
 	if err != nil {
813 813
 		return "", "", err
... ...
@@ -816,7 +816,7 @@ func (p *puller) pullOCI(ctx context.Context, ref reference.Named, mfst *ocische
816 816
 	return id, manifestDigest, err
817 817
 }
818 818
 
819
-func receiveConfig(configChan <-chan []byte, errChan <-chan error) ([]byte, *image.RootFS, *specs.Platform, error) {
819
+func receiveConfig(configChan <-chan []byte, errChan <-chan error) ([]byte, *image.RootFS, *ocispec.Platform, error) {
820 820
 	select {
821 821
 	case configJSON := <-configChan:
822 822
 		rootfs, err := rootFSFromConfig(configJSON)
... ...
@@ -837,13 +837,13 @@ func receiveConfig(configChan <-chan []byte, errChan <-chan error) ([]byte, *ima
837 837
 
838 838
 // pullManifestList handles "manifest lists" which point to various
839 839
 // platform-specific manifests.
840
-func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfstList *manifestlist.DeserializedManifestList, pp *specs.Platform) (id digest.Digest, manifestListDigest digest.Digest, err error) {
840
+func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfstList *manifestlist.DeserializedManifestList, pp *ocispec.Platform) (id digest.Digest, manifestListDigest digest.Digest, err error) {
841 841
 	manifestListDigest, err = schema2ManifestDigest(ref, mfstList)
842 842
 	if err != nil {
843 843
 		return "", "", err
844 844
 	}
845 845
 
846
-	var platform specs.Platform
846
+	var platform ocispec.Platform
847 847
 	if pp != nil {
848 848
 		platform = *pp
849 849
 	}
... ...
@@ -856,7 +856,7 @@ func (p *puller) pullManifestList(ctx context.Context, ref reference.Named, mfst
856 856
 			return "", "", err
857 857
 		}
858 858
 
859
-		desc := specs.Descriptor{
859
+		desc := ocispec.Descriptor{
860 860
 			Digest:    match.Digest,
861 861
 			Size:      match.Size,
862 862
 			MediaType: match.MediaType,
... ...
@@ -942,7 +942,7 @@ func (p *puller) pullSchema2Config(ctx context.Context, dgst digest.Digest) (con
942 942
 }
943 943
 
944 944
 type noMatchesErr struct {
945
-	platform specs.Platform
945
+	platform ocispec.Platform
946 946
 }
947 947
 
948 948
 func (e noMatchesErr) Error() string {
... ...
@@ -1081,13 +1081,13 @@ func createDownloadFile() (*os.File, error) {
1081 1081
 	return os.CreateTemp("", "GetImageBlob")
1082 1082
 }
1083 1083
 
1084
-func toOCIPlatform(p manifestlist.PlatformSpec) *specs.Platform {
1084
+func toOCIPlatform(p manifestlist.PlatformSpec) *ocispec.Platform {
1085 1085
 	// distribution pkg does define platform as pointer so this hack for empty struct
1086 1086
 	// is necessary. This is temporary until correct OCI image-spec package is used.
1087 1087
 	if p.OS == "" && p.Architecture == "" && p.Variant == "" && p.OSVersion == "" && p.OSFeatures == nil && p.Features == nil {
1088 1088
 		return nil
1089 1089
 	}
1090
-	return &specs.Platform{
1090
+	return &ocispec.Platform{
1091 1091
 		OS:           p.OS,
1092 1092
 		Architecture: p.Architecture,
1093 1093
 		Variant:      p.Variant,
... ...
@@ -1097,7 +1097,7 @@ func toOCIPlatform(p manifestlist.PlatformSpec) *specs.Platform {
1097 1097
 }
1098 1098
 
1099 1099
 // maximumSpec returns the distribution platform with maximum compatibility for the current node.
1100
-func maximumSpec() specs.Platform {
1100
+func maximumSpec() ocispec.Platform {
1101 1101
 	p := platforms.DefaultSpec()
1102 1102
 	if p.Architecture == "amd64" {
1103 1103
 		p.Variant = archvariant.AMD64Variant()
... ...
@@ -20,7 +20,7 @@ import (
20 20
 	"github.com/docker/docker/image"
21 21
 	"github.com/docker/docker/registry"
22 22
 	"github.com/opencontainers/go-digest"
23
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
23
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
24 24
 	"gotest.tools/v3/assert"
25 25
 	is "gotest.tools/v3/assert/cmp"
26 26
 )
... ...
@@ -194,7 +194,7 @@ func TestValidateManifest(t *testing.T) {
194 194
 }
195 195
 
196 196
 func TestFormatPlatform(t *testing.T) {
197
-	var platform specs.Platform
197
+	var platform ocispec.Platform
198 198
 	var result = formatPlatform(platform)
199 199
 	if strings.HasPrefix(result, "unknown") {
200 200
 		t.Fatal("expected formatPlatform to show a known platform")
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"github.com/containerd/containerd/platforms"
11 11
 	"github.com/docker/distribution"
12 12
 	"github.com/docker/distribution/manifest/manifestlist"
13
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
13
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
14 14
 	"github.com/sirupsen/logrus"
15 15
 )
16 16
 
... ...
@@ -19,7 +19,7 @@ func (ld *layerDescriptor) open(ctx context.Context) (distribution.ReadSeekClose
19 19
 	return blobs.Open(ctx, ld.digest)
20 20
 }
21 21
 
22
-func filterManifests(manifests []manifestlist.ManifestDescriptor, p specs.Platform) []manifestlist.ManifestDescriptor {
22
+func filterManifests(manifests []manifestlist.ManifestDescriptor, p ocispec.Platform) []manifestlist.ManifestDescriptor {
23 23
 	p = platforms.Normalize(withDefault(p))
24 24
 	m := platforms.Only(p)
25 25
 	var matches []manifestlist.ManifestDescriptor
... ...
@@ -53,7 +53,7 @@ func checkImageCompatibility(imageOS, imageOSVersion string) error {
53 53
 	return nil
54 54
 }
55 55
 
56
-func withDefault(p specs.Platform) specs.Platform {
56
+func withDefault(p ocispec.Platform) ocispec.Platform {
57 57
 	def := maximumSpec()
58 58
 	if p.OS == "" {
59 59
 		p.OS = def.OS
... ...
@@ -65,7 +65,7 @@ func withDefault(p specs.Platform) specs.Platform {
65 65
 	return p
66 66
 }
67 67
 
68
-func formatPlatform(platform specs.Platform) string {
68
+func formatPlatform(platform ocispec.Platform) string {
69 69
 	if platform.OS == "" {
70 70
 		platform = platforms.DefaultSpec()
71 71
 	}
... ...
@@ -18,7 +18,7 @@ import (
18 18
 	"github.com/docker/distribution/manifest/schema2"
19 19
 	"github.com/docker/distribution/registry/client/transport"
20 20
 	"github.com/docker/docker/pkg/system"
21
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
21
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
22 22
 	"github.com/sirupsen/logrus"
23 23
 )
24 24
 
... ...
@@ -65,7 +65,7 @@ func (ld *layerDescriptor) open(ctx context.Context) (distribution.ReadSeekClose
65 65
 	return rsc, err
66 66
 }
67 67
 
68
-func filterManifests(manifests []manifestlist.ManifestDescriptor, p specs.Platform) []manifestlist.ManifestDescriptor {
68
+func filterManifests(manifests []manifestlist.ManifestDescriptor, p ocispec.Platform) []manifestlist.ManifestDescriptor {
69 69
 	version := osversion.Get()
70 70
 	osVersion := fmt.Sprintf("%d.%d.%d", version.MajorVersion, version.MinorVersion, version.Build)
71 71
 	logrus.Debugf("will prefer Windows entries with version %s", osVersion)
... ...
@@ -139,7 +139,7 @@ func checkImageCompatibility(imageOS, imageOSVersion string) error {
139 139
 	return nil
140 140
 }
141 141
 
142
-func formatPlatform(platform specs.Platform) string {
142
+func formatPlatform(platform ocispec.Platform) string {
143 143
 	if platform.OS == "" {
144 144
 		platform = platforms.DefaultSpec()
145 145
 	}
... ...
@@ -17,7 +17,7 @@ import (
17 17
 	"github.com/docker/docker/errdefs"
18 18
 	ctr "github.com/docker/docker/integration/internal/container"
19 19
 	"github.com/docker/docker/oci"
20
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
20
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
21 21
 	"gotest.tools/v3/assert"
22 22
 	is "gotest.tools/v3/assert/cmp"
23 23
 	"gotest.tools/v3/poll"
... ...
@@ -475,7 +475,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
475 475
 	assert.Assert(t, img.Architecture != "")
476 476
 
477 477
 	t.Run("different os", func(t *testing.T) {
478
-		p := specs.Platform{
478
+		p := ocispec.Platform{
479 479
 			OS:           img.Os + "DifferentOS",
480 480
 			Architecture: img.Architecture,
481 481
 			Variant:      img.Variant,
... ...
@@ -484,7 +484,7 @@ func TestCreateDifferentPlatform(t *testing.T) {
484 484
 		assert.Assert(t, client.IsErrNotFound(err), err)
485 485
 	})
486 486
 	t.Run("different cpu arch", func(t *testing.T) {
487
-		p := specs.Platform{
487
+		p := ocispec.Platform{
488 488
 			OS:           img.Os,
489 489
 			Architecture: img.Architecture + "DifferentArch",
490 490
 			Variant:      img.Variant,
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"github.com/docker/docker/testutil/registry"
20 20
 	"github.com/opencontainers/go-digest"
21 21
 	"github.com/opencontainers/image-spec/specs-go"
22
-	imagespec "github.com/opencontainers/image-spec/specs-go/v1"
22
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
23 23
 	"gotest.tools/v3/assert"
24 24
 	"gotest.tools/v3/skip"
25 25
 )
... ...
@@ -36,7 +36,7 @@ func TestImagePullPlatformInvalid(t *testing.T) {
36 36
 	assert.Assert(t, errdefs.IsInvalidParameter(err))
37 37
 }
38 38
 
39
-func createTestImage(ctx context.Context, t testing.TB, store content.Store) imagespec.Descriptor {
39
+func createTestImage(ctx context.Context, t testing.TB, store content.Store) ocispec.Descriptor {
40 40
 	w, err := store.Writer(ctx, content.WithRef("layer"))
41 41
 	assert.NilError(t, err)
42 42
 	defer w.Close()
... ...
@@ -55,11 +55,11 @@ func createTestImage(ctx context.Context, t testing.TB, store content.Store) ima
55 55
 
56 56
 	platform := platforms.DefaultSpec()
57 57
 
58
-	img := imagespec.Image{
58
+	img := ocispec.Image{
59 59
 		Architecture: platform.Architecture,
60 60
 		OS:           platform.OS,
61
-		RootFS:       imagespec.RootFS{Type: "layers", DiffIDs: []digest.Digest{layerDigest}},
62
-		Config:       imagespec.ImageConfig{WorkingDir: "/"},
61
+		RootFS:       ocispec.RootFS{Type: "layers", DiffIDs: []digest.Digest{layerDigest}},
62
+		Config:       ocispec.ImageConfig{WorkingDir: "/"},
63 63
 	}
64 64
 	imgJSON, err := json.Marshal(img)
65 65
 	assert.NilError(t, err)
... ...
@@ -77,17 +77,17 @@ func createTestImage(ctx context.Context, t testing.TB, store content.Store) ima
77 77
 	info, err := store.Info(ctx, layerDigest)
78 78
 	assert.NilError(t, err)
79 79
 
80
-	manifest := imagespec.Manifest{
80
+	manifest := ocispec.Manifest{
81 81
 		Versioned: specs.Versioned{
82 82
 			SchemaVersion: 2,
83 83
 		},
84 84
 		MediaType: images.MediaTypeDockerSchema2Manifest,
85
-		Config: imagespec.Descriptor{
85
+		Config: ocispec.Descriptor{
86 86
 			MediaType: images.MediaTypeDockerSchema2Config,
87 87
 			Digest:    configDigest,
88 88
 			Size:      int64(len(imgJSON)),
89 89
 		},
90
-		Layers: []imagespec.Descriptor{{
90
+		Layers: []ocispec.Descriptor{{
91 91
 			MediaType: images.MediaTypeDockerSchema2Layer,
92 92
 			Digest:    layerDigest,
93 93
 			Size:      info.Size,
... ...
@@ -107,7 +107,7 @@ func createTestImage(ctx context.Context, t testing.TB, store content.Store) ima
107 107
 	manifestDigest := w.Digest()
108 108
 	w.Close()
109 109
 
110
-	return imagespec.Descriptor{
110
+	return ocispec.Descriptor{
111 111
 		MediaType: images.MediaTypeDockerSchema2Manifest,
112 112
 		Digest:    manifestDigest,
113 113
 		Size:      int64(len(manifestJSON)),
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"github.com/docker/docker/api/types/container"
10 10
 	"github.com/docker/docker/api/types/network"
11 11
 	"github.com/docker/docker/client"
12
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
12
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
13 13
 	"gotest.tools/v3/assert"
14 14
 )
15 15
 
... ...
@@ -20,7 +20,7 @@ type TestContainerConfig struct {
20 20
 	Config           *container.Config
21 21
 	HostConfig       *container.HostConfig
22 22
 	NetworkingConfig *network.NetworkingConfig
23
-	Platform         *specs.Platform
23
+	Platform         *ocispec.Platform
24 24
 }
25 25
 
26 26
 // create creates a container with the specified options
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	networktypes "github.com/docker/docker/api/types/network"
9 9
 	"github.com/docker/docker/api/types/strslice"
10 10
 	"github.com/docker/go-connections/nat"
11
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
11
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
12 12
 )
13 13
 
14 14
 // WithName sets the name of the container
... ...
@@ -204,7 +204,7 @@ func WithExtraHost(extraHost string) func(*TestContainerConfig) {
204 204
 }
205 205
 
206 206
 // WithPlatform specifies the desired platform the image should have.
207
-func WithPlatform(p *specs.Platform) func(*TestContainerConfig) {
207
+func WithPlatform(p *ocispec.Platform) func(*TestContainerConfig) {
208 208
 	return func(c *TestContainerConfig) {
209 209
 		c.Platform = p
210 210
 	}
... ...
@@ -23,7 +23,7 @@ import (
23 23
 	"github.com/docker/docker/testutil/fixtures/plugin"
24 24
 	"github.com/docker/docker/testutil/registry"
25 25
 	"github.com/docker/docker/testutil/request"
26
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
26
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
27 27
 	"gotest.tools/v3/assert"
28 28
 	is "gotest.tools/v3/assert/cmp"
29 29
 	"gotest.tools/v3/skip"
... ...
@@ -306,7 +306,7 @@ func TestPluginBackCompatMediaTypes(t *testing.T) {
306 306
 	assert.NilError(t, err)
307 307
 	defer rdr.Close()
308 308
 
309
-	var m v1.Manifest
309
+	var m ocispec.Manifest
310 310
 	assert.NilError(t, json.NewDecoder(rdr).Decode(&m))
311 311
 	assert.Check(t, is.Equal(m.MediaType, images.MediaTypeDockerSchema2Manifest))
312 312
 	assert.Check(t, is.Len(m.Layers, 1))
... ...
@@ -29,7 +29,7 @@ import (
29 29
 	libcontainerdtypes "github.com/docker/docker/libcontainerd/types"
30 30
 	"github.com/docker/docker/pkg/ioutils"
31 31
 	"github.com/hashicorp/go-multierror"
32
-	v1 "github.com/opencontainers/image-spec/specs-go/v1"
32
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
33 33
 	specs "github.com/opencontainers/runtime-spec/specs-go"
34 34
 	"github.com/pkg/errors"
35 35
 	"github.com/sirupsen/logrus"
... ...
@@ -439,12 +439,12 @@ func (t *task) CreateCheckpoint(ctx context.Context, checkpointDir string, exit
439 439
 	if err != nil {
440 440
 		return errdefs.System(errors.Wrapf(err, "failed to retrieve checkpoint data"))
441 441
 	}
442
-	var index v1.Index
442
+	var index ocispec.Index
443 443
 	if err := json.Unmarshal(b, &index); err != nil {
444 444
 		return errdefs.System(errors.Wrapf(err, "failed to decode checkpoint data"))
445 445
 	}
446 446
 
447
-	var cpDesc *v1.Descriptor
447
+	var cpDesc *ocispec.Descriptor
448 448
 	for _, m := range index.Manifests {
449 449
 		m := m
450 450
 		if m.MediaType == images.MediaTypeContainerd1Checkpoint {
... ...
@@ -35,7 +35,7 @@ import (
35 35
 	v2 "github.com/docker/docker/plugin/v2"
36 36
 	"github.com/moby/sys/mount"
37 37
 	"github.com/opencontainers/go-digest"
38
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
38
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
39 39
 	"github.com/pkg/errors"
40 40
 	"github.com/sirupsen/logrus"
41 41
 )
... ...
@@ -165,19 +165,19 @@ func (pm *Manager) Privileges(ctx context.Context, ref reference.Named, metaHead
165 165
 		configSeen bool
166 166
 	)
167 167
 
168
-	h := func(ctx context.Context, desc specs.Descriptor) ([]specs.Descriptor, error) {
168
+	h := func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
169 169
 		switch desc.MediaType {
170
-		case schema2.MediaTypeManifest, specs.MediaTypeImageManifest:
170
+		case schema2.MediaTypeManifest, ocispec.MediaTypeImageManifest:
171 171
 			data, err := content.ReadBlob(ctx, pm.blobStore, desc)
172 172
 			if err != nil {
173 173
 				return nil, errors.Wrapf(err, "error reading image manifest from blob store for %s", ref)
174 174
 			}
175 175
 
176
-			var m specs.Manifest
176
+			var m ocispec.Manifest
177 177
 			if err := json.Unmarshal(data, &m); err != nil {
178 178
 				return nil, errors.Wrapf(err, "error unmarshaling image manifest for %s", ref)
179 179
 			}
180
-			return []specs.Descriptor{m.Config}, nil
180
+			return []ocispec.Descriptor{m.Config}, nil
181 181
 		case schema2.MediaTypePluginConfig:
182 182
 			configSeen = true
183 183
 			data, err := content.ReadBlob(ctx, pm.blobStore, desc)
... ...
@@ -383,7 +383,7 @@ func (pm *Manager) Push(ctx context.Context, name string, metaHeader http.Header
383 383
 	out, waitProgress := setupProgressOutput(outStream, cancel)
384 384
 	defer waitProgress()
385 385
 
386
-	progressHandler := images.HandlerFunc(func(ctx context.Context, desc specs.Descriptor) ([]specs.Descriptor, error) {
386
+	progressHandler := images.HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
387 387
 		logrus.WithField("mediaType", desc.MediaType).WithField("digest", desc.Digest.String()).Debug("Preparing to push plugin layer")
388 388
 		id := stringid.TruncateID(desc.Digest.String())
389 389
 		pj.add(remotes.MakeRefKey(ctx, desc), id)
... ...
@@ -469,7 +469,7 @@ func (pm *Manager) Push(ctx context.Context, name string, metaHeader http.Header
469 469
 // even though this is set on the descriptor
470 470
 // The OCI types do not have this field.
471 471
 type manifest struct {
472
-	specs.Manifest
472
+	ocispec.Manifest
473 473
 	MediaType string `json:"mediaType,omitempty"`
474 474
 }
475 475
 
... ...
@@ -482,7 +482,7 @@ func buildManifest(ctx context.Context, s content.Manager, config digest.Digest,
482 482
 	if err != nil {
483 483
 		return m, errors.Wrapf(err, "error reading plugin config content for digest %s", config)
484 484
 	}
485
-	m.Config = specs.Descriptor{
485
+	m.Config = ocispec.Descriptor{
486 486
 		MediaType: mediaTypePluginConfig,
487 487
 		Size:      configInfo.Size,
488 488
 		Digest:    configInfo.Digest,
... ...
@@ -493,7 +493,7 @@ func buildManifest(ctx context.Context, s content.Manager, config digest.Digest,
493 493
 		if err != nil {
494 494
 			return m, errors.Wrapf(err, "error fetching info for content digest %s", l)
495 495
 		}
496
-		m.Layers = append(m.Layers, specs.Descriptor{
496
+		m.Layers = append(m.Layers, ocispec.Descriptor{
497 497
 			MediaType: images.MediaTypeDockerSchema2LayerGzip, // TODO: This is assuming everything is a gzip compressed layer, but that may not be true.
498 498
 			Digest:    l,
499 499
 			Size:      info.Size,
... ...
@@ -504,12 +504,12 @@ func buildManifest(ctx context.Context, s content.Manager, config digest.Digest,
504 504
 
505 505
 // getManifestDescriptor gets the OCI descriptor for a manifest
506 506
 // It will generate a manifest if one does not exist
507
-func (pm *Manager) getManifestDescriptor(ctx context.Context, p *v2.Plugin) (specs.Descriptor, error) {
507
+func (pm *Manager) getManifestDescriptor(ctx context.Context, p *v2.Plugin) (ocispec.Descriptor, error) {
508 508
 	logger := logrus.WithField("plugin", p.Name()).WithField("digest", p.Manifest)
509 509
 	if p.Manifest != "" {
510 510
 		info, err := pm.blobStore.Info(ctx, p.Manifest)
511 511
 		if err == nil {
512
-			desc := specs.Descriptor{
512
+			desc := ocispec.Descriptor{
513 513
 				Size:      info.Size,
514 514
 				Digest:    info.Digest,
515 515
 				MediaType: images.MediaTypeDockerSchema2Manifest,
... ...
@@ -524,7 +524,7 @@ func (pm *Manager) getManifestDescriptor(ctx context.Context, p *v2.Plugin) (spe
524 524
 
525 525
 	manifest, err := buildManifest(ctx, pm.blobStore, p.Config, p.Blobsums)
526 526
 	if err != nil {
527
-		return specs.Descriptor{}, err
527
+		return ocispec.Descriptor{}, err
528 528
 	}
529 529
 
530 530
 	desc, err := writeManifest(ctx, pm.blobStore, &manifest)
... ...
@@ -538,9 +538,9 @@ func (pm *Manager) getManifestDescriptor(ctx context.Context, p *v2.Plugin) (spe
538 538
 	return desc, nil
539 539
 }
540 540
 
541
-func writeManifest(ctx context.Context, cs content.Store, m *manifest) (specs.Descriptor, error) {
541
+func writeManifest(ctx context.Context, cs content.Store, m *manifest) (ocispec.Descriptor, error) {
542 542
 	platform := platforms.DefaultSpec()
543
-	desc := specs.Descriptor{
543
+	desc := ocispec.Descriptor{
544 544
 		MediaType: images.MediaTypeDockerSchema2Manifest,
545 545
 		Platform:  &platform,
546 546
 	}
... ...
@@ -19,7 +19,7 @@ import (
19 19
 	"github.com/docker/docker/pkg/progress"
20 20
 	"github.com/docker/docker/pkg/stringid"
21 21
 	"github.com/opencontainers/go-digest"
22
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
22
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
23 23
 	"github.com/pkg/errors"
24 24
 	"github.com/sirupsen/logrus"
25 25
 )
... ...
@@ -88,8 +88,8 @@ func (pm *Manager) fetch(ctx context.Context, ref reference.Named, auth *registr
88 88
 		headers := http.Header{}
89 89
 		headers.Add("Accept", images.MediaTypeDockerSchema2Manifest)
90 90
 		headers.Add("Accept", images.MediaTypeDockerSchema2ManifestList)
91
-		headers.Add("Accept", specs.MediaTypeImageManifest)
92
-		headers.Add("Accept", specs.MediaTypeImageIndex)
91
+		headers.Add("Accept", ocispec.MediaTypeImageManifest)
92
+		headers.Add("Accept", ocispec.MediaTypeImageIndex)
93 93
 		resolver, _ = pm.newResolver(ctx, nil, auth, headers, false)
94 94
 		if resolver != nil {
95 95
 			resolved, desc, err = resolver.Resolve(ctx, withDomain.String())
... ...
@@ -118,12 +118,12 @@ func (pm *Manager) fetch(ctx context.Context, ref reference.Named, auth *registr
118 118
 // if there are multiple layers to fetch we may end up extracting layers in the wrong
119 119
 // order.
120 120
 func applyLayer(cs content.Store, dir string, out progress.Output) images.HandlerFunc {
121
-	return func(ctx context.Context, desc specs.Descriptor) ([]specs.Descriptor, error) {
121
+	return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
122 122
 		switch desc.MediaType {
123 123
 		case
124
-			specs.MediaTypeImageLayer,
124
+			ocispec.MediaTypeImageLayer,
125 125
 			images.MediaTypeDockerSchema2Layer,
126
-			specs.MediaTypeImageLayerGzip,
126
+			ocispec.MediaTypeImageLayerGzip,
127 127
 			images.MediaTypeDockerSchema2LayerGzip:
128 128
 		default:
129 129
 			return nil, nil
... ...
@@ -150,7 +150,7 @@ func applyLayer(cs content.Store, dir string, out progress.Output) images.Handle
150 150
 
151 151
 func childrenHandler(cs content.Store) images.HandlerFunc {
152 152
 	ch := images.ChildrenHandler(cs)
153
-	return func(ctx context.Context, desc specs.Descriptor) ([]specs.Descriptor, error) {
153
+	return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
154 154
 		switch desc.MediaType {
155 155
 		case mediaTypePluginConfig:
156 156
 			return nil, nil
... ...
@@ -167,15 +167,15 @@ type fetchMeta struct {
167 167
 }
168 168
 
169 169
 func storeFetchMetadata(m *fetchMeta) images.HandlerFunc {
170
-	return func(ctx context.Context, desc specs.Descriptor) ([]specs.Descriptor, error) {
170
+	return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
171 171
 		switch desc.MediaType {
172 172
 		case
173 173
 			images.MediaTypeDockerSchema2LayerForeignGzip,
174 174
 			images.MediaTypeDockerSchema2Layer,
175
-			specs.MediaTypeImageLayer,
176
-			specs.MediaTypeImageLayerGzip:
175
+			ocispec.MediaTypeImageLayer,
176
+			ocispec.MediaTypeImageLayerGzip:
177 177
 			m.blobs = append(m.blobs, desc.Digest)
178
-		case specs.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
178
+		case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
179 179
 			m.manifest = desc.Digest
180 180
 		case mediaTypePluginConfig:
181 181
 			m.config = desc.Digest
... ...
@@ -196,9 +196,9 @@ func validateFetchedMetadata(md fetchMeta) error {
196 196
 
197 197
 // withFetchProgress is a fetch handler which registers a descriptor with a progress
198 198
 func withFetchProgress(cs content.Store, out progress.Output, ref reference.Named) images.HandlerFunc {
199
-	return func(ctx context.Context, desc specs.Descriptor) ([]specs.Descriptor, error) {
199
+	return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
200 200
 		switch desc.MediaType {
201
-		case specs.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
201
+		case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
202 202
 			tn := reference.TagNameOnly(ref)
203 203
 			tagged := tn.(reference.Tagged)
204 204
 			progress.Messagef(out, tagged.Tag(), "Pulling from %s", reference.FamiliarName(ref))
... ...
@@ -207,8 +207,8 @@ func withFetchProgress(cs content.Store, out progress.Output, ref reference.Name
207 207
 		case
208 208
 			images.MediaTypeDockerSchema2LayerGzip,
209 209
 			images.MediaTypeDockerSchema2Layer,
210
-			specs.MediaTypeImageLayer,
211
-			specs.MediaTypeImageLayerGzip:
210
+			ocispec.MediaTypeImageLayer,
211
+			ocispec.MediaTypeImageLayerGzip:
212 212
 		default:
213 213
 			return nil, nil
214 214
 		}
... ...
@@ -18,7 +18,7 @@ import (
18 18
 	v2 "github.com/docker/docker/plugin/v2"
19 19
 	"github.com/moby/sys/mount"
20 20
 	"github.com/opencontainers/go-digest"
21
-	specs "github.com/opencontainers/image-spec/specs-go/v1"
21
+	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
22 22
 	"github.com/pkg/errors"
23 23
 	"github.com/sirupsen/logrus"
24 24
 	"golang.org/x/sys/unix"
... ...
@@ -267,7 +267,7 @@ func (pm *Manager) upgradePlugin(p *v2.Plugin, configDigest, manifestDigest dige
267 267
 }
268 268
 
269 269
 func (pm *Manager) setupNewPlugin(configDigest digest.Digest, privileges *types.PluginPrivileges) (types.PluginConfig, error) {
270
-	configRA, err := pm.blobStore.ReaderAt(context.TODO(), specs.Descriptor{Digest: configDigest})
270
+	configRA, err := pm.blobStore.ReaderAt(context.TODO(), ocispec.Descriptor{Digest: configDigest})
271 271
 	if err != nil {
272 272
 		return types.PluginConfig{}, err
273 273
 	}