func FindRegistry(ctx *types.SystemContext, ref string) (*Registry, error) {
	registries, err := GetRegistries(ctx)
	if err != nil {
		return nil, err
	}

	reg := Registry{}
	prefixLen := 0
	for _, r := range registries {
		if refMatchesPrefix(ref, r.Prefix) {
			length := len(r.Prefix)
			if length > prefixLen {
				reg = r
				prefixLen = length
			}
		}
	}
	if prefixLen != 0 {
		return &reg, nil
	}
	return nil, nil
}
func FindRegistry(ctx *types.SystemContext, ref string) (*Registry, error) {
	registries, err := GetRegistries(ctx)
	if err != nil {
		return nil, err
	}

	reg := Registry{}
	prefixLen := 0
	for _, r := range registries {
		if refMatchesPrefix(ref, r.Prefix) {
			length := len(r.Prefix)
			if length > prefixLen {
				reg = r
				prefixLen = length
			}
		}
	}
	if prefixLen != 0 {
		return &reg, nil
	}
	return nil, nil
}
func FindRegistry ( ctx * types . SystemContext , ref string ) ( * Registry , error ) { registries , err := GetRegistries ( ctx ) if err != nil { return nil , err } reg := Registry { } prefixLen := 0 for _ , r := range registries { if refMatchesPrefix ( ref , r . Prefix ) { length := len ( r . Prefix ) if length > prefixLen { reg = r prefixLen = length } } } if prefixLen != 0 { return & reg , nil } return nil , nil }
// FindRegistry returns the Registry with the longest prefix for ref,
// which is a registry, repository namespace repository or image reference (as formatted by
// reference.Domain(), reference.Named.Name() or reference.Reference.String()
// — note that this requires the name to start with an explicit hostname!).
// If no Registry prefixes the image, nil is returned.
FindRegistry returns the Registry with the longest prefix for ref which is a registry repository namespace repository or image reference ( as formatted by reference . Domain () reference . Named . Name () or reference . Reference . String () — note that this requires the name to start with an explicit hostname! ) . If no Registry prefixes the image nil is returned .