本文整理匯總了Golang中github.com/openshift/origin/pkg/image/api.DockerImageReference.Registry方法的典型用法代碼示例。如果您正苦於以下問題:Golang DockerImageReference.Registry方法的具體用法?Golang DockerImageReference.Registry怎麽用?Golang DockerImageReference.Registry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/origin/pkg/image/api.DockerImageReference
的用法示例。
在下文中一共展示了DockerImageReference.Registry方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Get
// Get retrieves the manifest with digest `dgst`.
func (r *repository) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error) {
if err := r.checkPendingErrors(ctx); err != nil {
return nil, err
}
if _, err := r.getImageStreamImage(dgst); err != nil {
context.GetLogger(r.ctx).Errorf("error retrieving ImageStreamImage %s/%[email protected]%s: %v", r.namespace, r.name, dgst.String(), err)
return nil, err
}
image, err := r.getImage(dgst)
if err != nil {
context.GetLogger(r.ctx).Errorf("error retrieving image %s: %v", dgst.String(), err)
return nil, err
}
ref := imageapi.DockerImageReference{Namespace: r.namespace, Name: r.name, Registry: r.registryAddr}
if managed := image.Annotations[imageapi.ManagedByOpenShiftAnnotation]; managed == "true" {
// Repository without a registry part is refers to repository containing locally managed images.
// Such an entry is retrieved, checked and set by blobDescriptorService operating only on local blobs.
ref.Registry = ""
} else {
// Repository with a registry points to remote repository. This is used by pullthrough middleware.
ref = ref.DockerClientDefaults().AsRepository()
}
manifest, err := r.manifestFromImageWithCachedLayers(image, ref.Exact())
return manifest, err
}
示例2: autoConvert_v1_DockerImageReference_To_api_DockerImageReference
func autoConvert_v1_DockerImageReference_To_api_DockerImageReference(in *DockerImageReference, out *api.DockerImageReference, s conversion.Scope) error {
out.Registry = in.Registry
out.Namespace = in.Namespace
out.Name = in.Name
out.Tag = in.Tag
out.ID = in.ID
return nil
}
示例3: autoConvert_v1_DockerImageReference_To_api_DockerImageReference
func autoConvert_v1_DockerImageReference_To_api_DockerImageReference(in *DockerImageReference, out *image_api.DockerImageReference, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*DockerImageReference))(in)
}
out.Registry = in.Registry
out.Namespace = in.Namespace
out.Name = in.Name
out.Tag = in.Tag
out.ID = in.ID
return nil
}
示例4: Search
// Search searches in the Docker registry for images that match terms
func (r DockerRegistrySearcher) Search(precise bool, terms ...string) (ComponentMatches, []error) {
componentMatches := ComponentMatches{}
var errs []error
for _, term := range terms {
var (
ref imageapi.DockerImageReference
err error
)
if term != "*" {
ref, err = imageapi.ParseDockerImageReference(term)
if err != nil {
continue
}
} else {
ref = imageapi.DockerImageReference{Name: term}
}
glog.V(4).Infof("checking Docker registry for %q, allow-insecure=%v", ref.String(), r.AllowInsecure)
connection, err := r.Client.Connect(ref.Registry, r.AllowInsecure)
if err != nil {
if dockerregistry.IsRegistryNotFound(err) {
errs = append(errs, err)
continue
}
errs = append(errs, fmt.Errorf("can't connect to %q: %v", ref.Registry, err))
continue
}
image, err := connection.ImageByTag(ref.Namespace, ref.Name, ref.Tag)
if err != nil {
if dockerregistry.IsNotFound(err) {
if dockerregistry.IsTagNotFound(err) {
glog.V(4).Infof("tag not found: %v", err)
}
continue
}
errs = append(errs, fmt.Errorf("can't connect to %q: %v", ref.Registry, err))
continue
}
if len(ref.Tag) == 0 {
ref.Tag = imageapi.DefaultImageTag
}
if len(ref.Registry) == 0 {
ref.Registry = "Docker Hub"
}
glog.V(4).Infof("found image: %#v", image)
dockerImage := &imageapi.DockerImage{}
if err = kapi.Scheme.Convert(&image.Image, dockerImage, nil); err != nil {
errs = append(errs, err)
continue
}
match := &ComponentMatch{
Value: term,
Argument: fmt.Sprintf("--docker-image=%q", term),
Name: term,
Description: descriptionFor(dockerImage, term, ref.Registry, ref.Tag),
Score: 0,
Image: dockerImage,
ImageTag: ref.Tag,
Insecure: r.AllowInsecure,
Meta: map[string]string{"registry": ref.Registry},
}
glog.V(2).Infof("Adding %s as component match for %q with score %v", match.Description, term, match.Score)
componentMatches = append(componentMatches, match)
}
return componentMatches, errs
}