Version: v1.2.23 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2022 License: Apache-2.0 Imports: 3 Imported by: 0



Package repository provides Repository abstraction to handle Docker repositories. This includes parsing and validation of repo specification passed in a text form, as well as association of the Docker repository with tags (images) it should contain.



View Source

RefSpec is the description of a valid Docker repository specification


View Source
var InsecureRegistryEx = `^(127\..*|::1|localhost)(:[0-9]+)?$`

InsecureRegistryEx contains a regex string to match insecure (non-HTTPS) registries


func GetRegistry

func GetRegistry(ref string) string

GetRegistry extracts registry address from the repository reference


type Repository

type Repository struct {
	// contains filtered or unexported fields

Repository is a parsed, valid Docker repository reference

func ParseRef

func ParseRef(ref string) (*Repository, error)

ParseRef takes a string repository reference and transforms it into a Repository structure

func ParseRefs

func ParseRefs(refs []string) ([]*Repository, error)

ParseRefs is a shorthand for ParseRef to parse multiple repository references at once

func (*Repository) Filter

func (r *Repository) Filter() string

Filter gives us a string form of /FILTER/ regexp we use to match repository tags

func (*Repository) Full

func (r *Repository) Full() string

Full gives us repository in a "full" form REGISTRY[:PORT]/REPOSITORY

func (*Repository) HasFilter

func (r *Repository) HasFilter() bool

HasFilter tells us if we've specified /FILTER/ regexp to match tags for this repository

func (*Repository) HasTags

func (r *Repository) HasTags() bool

HasTags tells us if we've specified some concrete tags for this repository

func (*Repository) IsDefaultRegistry

func (r *Repository) IsDefaultRegistry() bool

IsDefaultRegistry tells us if we use default registry (DockerHub)

func (*Repository) IsSecure

func (r *Repository) IsSecure() bool

IsSecure tells us if we use secure (HTTPS) connection for this registry/repository

func (*Repository) IsSingle

func (r *Repository) IsSingle() bool

IsSingle tells us if we created repo from reference having only single tag specified

func (*Repository) MatchTag

func (r *Repository) MatchTag(tag string) bool

MatchTag matches passed tag against repository tag and filter specification

func (*Repository) Name

func (r *Repository) Name() string

Name is same as Full() but cuts leading REGISTRY[:PORT]/ if we use default registry (DockerHub)

func (*Repository) Path

func (r *Repository) Path() string

Path gives us repository path without registry hostname e.g. "library/alpine"

func (*Repository) PushPath added in v1.1.4

func (r *Repository) PushPath(pathSeparator string) string

PushPath returns a repository path with a custom path element separator

func (*Repository) PushPrefix

func (r *Repository) PushPrefix() string

PushPrefix generates prefix path for repository in a "push" registry

func (*Repository) Ref

func (r *Repository) Ref() string

Ref gets original repository reference string

func (*Repository) Registry

func (r *Repository) Registry() string

Registry gets registry ADDR[:PORT]

func (*Repository) Tags

func (r *Repository) Tags() []string

Tags gives us list of tags we specified for this repository (It will return `[]string{}` if we have not specified any)

func (*Repository) WebSchema

func (r *Repository) WebSchema() string

WebSchema tells us we use "http://" or "https://" to connect to this registry/repository

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL