@@ -387,6 +387,52 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
387387 dockerCmd (c , "rmi" , repoName )
388388}
389389
390+ // #23100
391+ func (s * DockerRegistryAuthHtpasswdSuite ) TestPullWithExternalAuthLoginWithScheme (c * check.C ) {
392+ osPath := os .Getenv ("PATH" )
393+ defer os .Setenv ("PATH" , osPath )
394+
395+ workingDir , err := os .Getwd ()
396+ c .Assert (err , checker .IsNil )
397+ absolute , err := filepath .Abs (filepath .Join (workingDir , "fixtures" , "auth" ))
398+ c .Assert (err , checker .IsNil )
399+ testPath := fmt .Sprintf ("%s%c%s" , osPath , filepath .ListSeparator , absolute )
400+
401+ os .Setenv ("PATH" , testPath )
402+
403+ repoName := fmt .Sprintf ("%v/dockercli/busybox:authtest" , privateRegistryURL )
404+
405+ tmp , err := ioutil .TempDir ("" , "integration-cli-" )
406+ c .Assert (err , checker .IsNil )
407+
408+ externalAuthConfig := `{ "credsStore": "shell-test" }`
409+
410+ configPath := filepath .Join (tmp , "config.json" )
411+ err = ioutil .WriteFile (configPath , []byte (externalAuthConfig ), 0644 )
412+ c .Assert (err , checker .IsNil )
413+
414+ dockerCmd (c , "--config" , tmp , "login" , "-u" , s .reg .username , "-p" , s .reg .password , privateRegistryURL )
415+
416+ b , err := ioutil .ReadFile (configPath )
417+ c .Assert (err , checker .IsNil )
418+ c .Assert (string (b ), checker .Not (checker .Contains ), "\" auth\" :" )
419+
420+ dockerCmd (c , "--config" , tmp , "tag" , "busybox" , repoName )
421+ dockerCmd (c , "--config" , tmp , "push" , repoName )
422+
423+ dockerCmd (c , "--config" , tmp , "logout" , privateRegistryURL )
424+ dockerCmd (c , "--config" , tmp , "login" , "-u" , s .reg .username , "-p" , s .reg .password , "https://" + privateRegistryURL )
425+ dockerCmd (c , "--config" , tmp , "pull" , repoName )
426+
427+ // likewise push should work
428+ repoName2 := fmt .Sprintf ("%v/dockercli/busybox:nocreds" , privateRegistryURL )
429+ dockerCmd (c , "tag" , repoName , repoName2 )
430+ dockerCmd (c , "--config" , tmp , "push" , repoName2 )
431+
432+ // logout should work w scheme also because it will be stripped
433+ dockerCmd (c , "--config" , tmp , "logout" , "https://" + privateRegistryURL )
434+ }
435+
390436func (s * DockerRegistryAuthHtpasswdSuite ) TestPullWithExternalAuth (c * check.C ) {
391437 osPath := os .Getenv ("PATH" )
392438 defer os .Setenv ("PATH" , osPath )
0 commit comments