Skip to content

Commit 43b03ef

Browse files
committed
trust: print deprecation warning when using hub Notary server
Docker Hub's Notary service is being retired, and now produces failures in most cases. Add a warning when attempting to use it, pending full removal of trust; https://www.docker.com/blog/retiring-docker-content-trust/ With this PR: DOCKER_CONTENT_TRUST=1 docker pull -q hello-world WARNING: Docker is retiring DCT for Docker Official Images (DOI). For details, refer to https://docs.docker.com/go/dct-deprecation/ could not validate the path to a trusted root: unable to retrieve valid leaf certificates Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 6855d70 commit 43b03ef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cli/trust/trust.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ func (scs simpleCredentialStore) RefreshToken(*url.URL, string) string {
108108

109109
func (simpleCredentialStore) SetRefreshToken(*url.URL, string, string) {}
110110

111+
const dctDeprecation = `WARNING: Docker is retiring DCT for Docker Official Images (DOI).
112+
For details, refer to https://docs.docker.com/go/dct-deprecation/
113+
114+
`
115+
111116
// GetNotaryRepository returns a NotaryRepository which stores all the
112117
// information needed to operate on a notary repository.
113118
// It creates an HTTP transport providing authentication support.
@@ -116,6 +121,9 @@ func GetNotaryRepository(in io.Reader, out io.Writer, userAgent string, repoInfo
116121
if err != nil {
117122
return nil, err
118123
}
124+
if server == NotaryServer {
125+
_, _ = fmt.Fprint(os.Stderr, dctDeprecation)
126+
}
119127

120128
cfg := tlsconfig.ClientDefault()
121129
cfg.InsecureSkipVerify = !repoInfo.Index.Secure

0 commit comments

Comments
 (0)