src/server/pps/cmds/cmds.go
func isDockerUsingKeychain() bool {
	user, err := user.Current()
	if err != nil {
		return false
	}

	contents, err := ioutil.ReadFile(path.Join(user.HomeDir, ".docker/config.json"))
	if err != nil {
		return false
	}

	var j map[string]interface{}

	if err = json.Unmarshal(contents, &j); err != nil {
		return false
	}

	auths, ok := j["auths"]
	if !ok {
		return false
	}

	authsInner, ok := auths.(map[string]interface{})
	if !ok {
		return false
	}

	index, ok := authsInner["https://index.docker.io/v1/"]
	if !ok {
		return false
	}

	indexInner, ok := index.(map[string]interface{})
	if !ok || len(indexInner) > 0 {
		return false
	}

	return j["credsStore"] == "osxkeychain"
}
func isDockerUsingKeychain() bool {
	user, err := user.Current()
	if err != nil {
		return false
	}

	contents, err := ioutil.ReadFile(path.Join(user.HomeDir, ".docker/config.json"))
	if err != nil {
		return false
	}

	var j map[string]interface{}

	if err = json.Unmarshal(contents, &j); err != nil {
		return false
	}

	auths, ok := j["auths"]
	if !ok {
		return false
	}

	authsInner, ok := auths.(map[string]interface{})
	if !ok {
		return false
	}

	index, ok := authsInner["https://index.docker.io/v1/"]
	if !ok {
		return false
	}

	indexInner, ok := index.(map[string]interface{})
	if !ok || len(indexInner) > 0 {
		return false
	}

	return j["credsStore"] == "osxkeychain"
}
func isDockerUsingKeychain ( ) bool { user , err := user . Current ( ) if err != nil { return false } contents , err := ioutil . ReadFile ( path . Join ( user . HomeDir , " " ) ) if err != nil { return false } var j map [ string ] interface { } if err = json . Unmarshal ( contents , & j ) ; err != nil { return false } auths , ok := j [ " " ] if ! ok { return false } authsInner , ok := auths . ( map [ string ] interface { } ) if ! ok { return false } index , ok := authsInner [ " " ] if ! ok { return false } indexInner , ok := index . ( map [ string ] interface { } ) if ! ok || len ( indexInner ) > 0 { return false } return j [ " " ] == " " }
// isDockerUsingKeychain checks if the user has a configuration that is not
// readable by our current docker client library.
// TODO(ys): remove if/when this issue is addressed:
// https://github.com/fsouza/go-dockerclient/issues/677
isDockerUsingKeychain checks if the user has a configuration that is not readable by our current docker client library . TODO ( ys ) : remove if / when this issue is addressed : https : // github . com / fsouza / go - dockerclient / issues / 677