diff --git a/distribution/pull_v2.go b/distribution/pull_v2.go index 8a5989597e..dd91ff2157 100644 --- a/distribution/pull_v2.go +++ b/distribution/pull_v2.go @@ -23,7 +23,7 @@ import ( "github.com/docker/docker/distribution/metadata" "github.com/docker/docker/distribution/xfer" "github.com/docker/docker/image" - "github.com/docker/docker/image/v1" + v1 "github.com/docker/docker/image/v1" "github.com/docker/docker/layer" "github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/progress" @@ -392,6 +392,10 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named, platform if p.config.RequireSchema2 { return false, fmt.Errorf("invalid manifest: not schema2") } + msg := schema1DeprecationMessage(ref) + logrus.Warn(msg) + progress.Message(p.config.ProgressOutput, "", msg) + id, manifestDigest, err = p.pullSchema1(ctx, ref, v, platform) if err != nil { return false, err @@ -787,6 +791,10 @@ func (p *v2Puller) pullManifestList(ctx context.Context, ref reference.Named, mf switch v := manifest.(type) { case *schema1.SignedManifest: + msg := schema1DeprecationMessage(ref) + logrus.Warn(msg) + progress.Message(p.config.ProgressOutput, "", msg) + platform := toOCIPlatform(manifestMatches[0].Platform) id, _, err = p.pullSchema1(ctx, manifestRef, v, &platform) if err != nil { diff --git a/distribution/push_v2.go b/distribution/push_v2.go index bbd14da1cb..e15384eba7 100644 --- a/distribution/push_v2.go +++ b/distribution/push_v2.go @@ -188,6 +188,10 @@ func (p *v2Pusher) pushV2Tag(ctx context.Context, ref reference.NamedTagged, id logrus.Warnf("failed to upload schema2 manifest: %v - falling back to schema1", err) + msg := schema1DeprecationMessage(ref) + logrus.Warn(msg) + progress.Message(p.config.ProgressOutput, "", msg) + manifestRef, err := reference.WithTag(p.repo.Named(), ref.Tag()) if err != nil { return err diff --git a/distribution/registry.go b/distribution/registry.go index d81530b75c..c474d14473 100644 --- a/distribution/registry.go +++ b/distribution/registry.go @@ -156,3 +156,7 @@ func (th *existingTokenHandler) AuthorizeRequest(req *http.Request, params map[s req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", th.token)) return nil } + +func schema1DeprecationMessage(ref reference.Named) string { + return fmt.Sprintf("[DEPRECATION NOTICE] registry v2 schema1 support will be removed in an upcoming release. Please contact admins of the %s registry NOW to avoid future disruption.", reference.Domain(ref)) +}