Sfoglia il codice sorgente

prompt a cli login if receive 401 from registry v2 auth server

Signed-off-by: tgic <farmer1992@gmail.com>
tgic 10 anni fa
parent
commit
fe7b3658bd
1 ha cambiato i file con 1 aggiunte e 0 eliminazioni
  1. 1 0
      api/client/utils.go

+ 1 - 0
api/client/utils.go

@@ -132,6 +132,7 @@ func (cli *DockerCli) clientRequestAttemptLogin(method, path string, in io.Reade
 			// we may need to change the status code.
 			// we may need to change the status code.
 			if strings.Contains(err.Error(), "Authentication is required") ||
 			if strings.Contains(err.Error(), "Authentication is required") ||
 				strings.Contains(err.Error(), "Status 401") ||
 				strings.Contains(err.Error(), "Status 401") ||
+				strings.Contains(err.Error(), "401 Unauthorized") ||
 				strings.Contains(err.Error(), "status code 401") {
 				strings.Contains(err.Error(), "status code 401") {
 				statusCode = http.StatusUnauthorized
 				statusCode = http.StatusUnauthorized
 			}
 			}