Merge pull request #982 from tiborvass/fix-stdin-blocking
session: add lock to fix hangdocker-19.03
commit
97b4b9a6db
|
@ -3,6 +3,7 @@ package authprovider
|
|||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
|
||||
"github.com/docker/cli/cli/config"
|
||||
"github.com/docker/cli/cli/config/configfile"
|
||||
|
@ -19,6 +20,12 @@ func NewDockerAuthProvider() session.Attachable {
|
|||
|
||||
type authProvider struct {
|
||||
config *configfile.ConfigFile
|
||||
|
||||
// The need for this mutex is not well understood.
|
||||
// Without it, the docker cli on OS X hangs when
|
||||
// reading credentials from docker-credential-osxkeychain.
|
||||
// See issue https://github.com/docker/cli/issues/1862
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func (ap *authProvider) Register(server *grpc.Server) {
|
||||
|
@ -26,6 +33,8 @@ func (ap *authProvider) Register(server *grpc.Server) {
|
|||
}
|
||||
|
||||
func (ap *authProvider) Credentials(ctx context.Context, req *auth.CredentialsRequest) (*auth.CredentialsResponse, error) {
|
||||
ap.mu.Lock()
|
||||
defer ap.mu.Unlock()
|
||||
if req.Host == "registry-1.docker.io" {
|
||||
req.Host = "https://index.docker.io/v1/"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue