Documentation ¶
Index ¶
- Constants
- Variables
- func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint, ...) (distribution.Repository, error)
- type Graph
- func (graph *Graph) ByParent() map[string][]*image.Image
- func (graph *Graph) CheckDepth(img *image.Image) error
- func (graph *Graph) Create(layerData archive.Reader, containerID, containerImage, comment, author string, ...) (*image.Image, error)
- func (graph *Graph) Delete(name string) error
- func (graph *Graph) Exists(id string) bool
- func (graph *Graph) Get(name string) (*image.Image, error)
- func (graph *Graph) GetDigest(id string) (digest.Digest, error)
- func (graph *Graph) GetParent(img *image.Image) (*image.Image, error)
- func (graph *Graph) GetParentsSize(img *image.Image) int64
- func (graph *Graph) Heads() map[string]*image.Image
- func (graph *Graph) IsHeld(layerID string) bool
- func (graph *Graph) IsNotExist(err error, id string) bool
- func (graph *Graph) Map() map[string]*image.Image
- func (graph *Graph) RawJSON(id string) ([]byte, error)
- func (graph *Graph) Register(img *image.Image, layerData archive.Reader) (err error)
- func (graph *Graph) Release(sessionID string, layerIDs ...string)
- func (graph *Graph) Retain(sessionID string, layerIDs ...string)
- func (graph *Graph) SetDigest(id string, dgst digest.Digest) error
- func (graph *Graph) TarLayer(img *image.Image) (arch archive.Archive, err error)
- func (graph *Graph) TempLayerArchive(id string, sf *streamformatter.StreamFormatter, output io.Writer) (*archive.TempArchive, error)
- func (graph *Graph) WalkHistory(img *image.Image, handler func(image.Image) error) (err error)
- type ImagePullConfig
- type ImagePushConfig
- type Puller
- type Pusher
- type Repository
- type TagStore
- func (store *TagStore) ByID() map[string][]string
- func (store *TagStore) Delete(repoName, ref string) (bool, error)
- func (store *TagStore) DeleteAll(id string) error
- func (store *TagStore) Get(repoName string) (Repository, error)
- func (store *TagStore) GetImage(repoName, refOrID string) (*image.Image, error)
- func (store *TagStore) GetRepoRefs() map[string][]string
- func (s *TagStore) History(name string) ([]*types.ImageHistory, error)
- func (s *TagStore) ImageExport(names []string, outStream io.Writer) error
- func (store *TagStore) ImageName(id string) string
- func (s *TagStore) ImageTarLayer(name string, dest io.Writer) error
- func (s *TagStore) Images(filterArgs, filter string, all bool) ([]*types.Image, error)
- func (s *TagStore) Import(src string, repo string, tag string, inConfig io.ReadCloser, ...) error
- func (s *TagStore) Load(inTar io.ReadCloser, outStream io.Writer) error
- func (s *TagStore) Lookup(name string) (*types.ImageInspect, error)
- func (store *TagStore) LookupImage(name string) (*image.Image, error)
- func (s *TagStore) NewPusher(endpoint registry.APIEndpoint, localRepo Repository, ...) (Pusher, error)
- func (s *TagStore) Pull(image string, tag string, imagePullConfig *ImagePullConfig) error
- func (s *TagStore) Push(localName string, imagePushConfig *ImagePushConfig) error
- func (store *TagStore) SetDigest(repoName, digest, imageName string) error
- func (store *TagStore) Tag(repoName, tag, imageName string, force bool) error
- type TagStoreConfig
Constants ¶
const MaxImageDepth = 127
Set the max depth to the aufs default that most kernels are compiled with For more information see: http://sourceforge.net/p/aufs/aufs3-standalone/ci/aufs3.12/tree/config.mk
Variables ¶
var ( // ErrDigestNotSet is used when request the digest for a layer // but the layer has no digest value or content to compute the // the digest. ErrDigestNotSet = errors.New("digest is not set for layer") )
Functions ¶
func NewV2Repository ¶
func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint, metaHeaders http.Header, authConfig *cliconfig.AuthConfig) (distribution.Repository, error)
NewV2Repository returns a repository (v2 only). It creates a HTTP transport providing timeout settings and authentication support, and also verifies the remote API version.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
A Graph is a store for versioned filesystem images and the relationship between them.
func NewGraph ¶
func NewGraph(root string, driver graphdriver.Driver) (*Graph, error)
NewGraph instantiates a new graph at the given root path in the filesystem. `root` will be created if it doesn't exist.
func (*Graph) ByParent ¶
ByParent returns a lookup table of images by their parent. If an image of key ID has 3 children images, then the value for key ID will be a list of 3 images. If an image has no children, it will not have an entry in the table.
func (*Graph) CheckDepth ¶
CheckDepth returns an error if the depth of an image, as returned by ImageDepth, is too large to support creating a container from it on this daemon.
func (*Graph) Create ¶
func (graph *Graph) Create(layerData archive.Reader, containerID, containerImage, comment, author string, containerConfig, config *runconfig.Config) (*image.Image, error)
Create creates a new image and registers it in the graph.
func (*Graph) Exists ¶
Exists returns true if an image is registered at the given id. If the image doesn't exist or if an error is encountered, false is returned.
func (*Graph) Get ¶
Get returns the image with the given id, or an error if the image doesn't exist.
func (*Graph) GetParentsSize ¶
GetParentsSize returns the combined size of all parent images. If there is no parent image or it's unavailable, it returns 0.
func (*Graph) Heads ¶
Heads returns all heads in the graph, keyed by id. A head is an image which is not the parent of another image in the graph.
func (*Graph) IsHeld ¶
IsHeld returns whether the given layerID is being used by an ongoing pull or build.
func (*Graph) IsNotExist ¶
IsNotExist detects whether an image exists by parsing the incoming error message.
func (*Graph) Retain ¶
Retain keeps the images and layers that are in the pulling chain so that they are not deleted. If not retained, they may be deleted by rmi.
func (*Graph) TempLayerArchive ¶
func (graph *Graph) TempLayerArchive(id string, sf *streamformatter.StreamFormatter, output io.Writer) (*archive.TempArchive, error)
TempLayerArchive creates a temporary archive of the given image's filesystem layer.
The archive is stored on disk and will be automatically deleted as soon as has been read. If output is not nil, a human-readable progress bar will be written to it.
type ImagePullConfig ¶
type ImagePullConfig struct { // MetaHeaders stores HTTP headers with metadata about the image // (DockerHeaders with prefix X-Meta- in the request). MetaHeaders map[string][]string // AuthConfig holds authentication credentials for authenticating with // the registry. AuthConfig *cliconfig.AuthConfig // OutStream is the output writer for showing the status of the pull // operation. OutStream io.Writer }
ImagePullConfig stores pull configuration.
type ImagePushConfig ¶
type ImagePushConfig struct { // MetaHeaders store HTTP headers with metadata about the image // (DockerHeaders with prefix X-Meta- in the request). MetaHeaders map[string][]string // AuthConfig holds authentication credentials for authenticating with // the registry. AuthConfig *cliconfig.AuthConfig // Tag is the specific variant of the image to be pushed. // If no tag is provided, all tags will be pushed. Tag string // OutStream is the output writer for showing the status of the push // operation. OutStream io.Writer }
ImagePushConfig stores push configuration.
type Puller ¶
type Puller interface { // Pull tries to pull the image referenced by `tag` // Pull returns an error if any, as well as a boolean that determines whether to retry Pull on the next configured endpoint. // // TODO(tiborvass): have Pull() take a reference to repository + tag, so that the puller itself is repository-agnostic. Pull(tag string) (fallback bool, err error) }
Puller is an interface that abstracts pulling for different API versions.
func NewPuller ¶
func NewPuller(s *TagStore, endpoint registry.APIEndpoint, repoInfo *registry.RepositoryInfo, imagePullConfig *ImagePullConfig, sf *streamformatter.StreamFormatter) (Puller, error)
NewPuller returns a Puller interface that will pull from either a v1 or v2 registry. The endpoint argument contains a Version field that determines whether a v1 or v2 puller will be created. The other parameters are passed through to the underlying puller implementation for use during the actual pull operation.
type Pusher ¶
type Pusher interface { // Push tries to push the image configured at the creation of Pusher. // Push returns an error if any, as well as a boolean that determines whether to retry Push on the next configured endpoint. // // TODO(tiborvass): have Push() take a reference to repository + tag, so that the pusher itself is repository-agnostic. Push() (fallback bool, err error) }
Pusher is an interface that abstracts pushing for different API versions.
type Repository ¶
Repository maps tags to image IDs.
func (Repository) Contains ¶
func (r Repository) Contains(u Repository) bool
Contains returns true if the contents of Repository u are wholly contained in Repository r.
func (Repository) Update ¶
func (r Repository) Update(u Repository)
Update updates repository mapping with content of repository 'u'.
type TagStore ¶
type TagStore struct { // Repositories is a map of repositories, indexed by name. Repositories map[string]Repository sync.Mutex // contains filtered or unexported fields }
TagStore manages repositories. It encompasses the Graph used for versioned storage, as well as various services involved in pushing and pulling repositories.
func NewTagStore ¶
func NewTagStore(path string, cfg *TagStoreConfig) (*TagStore, error)
NewTagStore creates a new TagStore at specified path, using the parameters and services provided in cfg.
func (*TagStore) ByID ¶
ByID returns a reverse-lookup table of all the names which refer to each image - e.g. {"43b5f19b10584": {"base:latest", "base:v1"}}
func (*TagStore) Delete ¶
Delete deletes a repository or a specific tag. If ref is empty, the entire repository named repoName will be deleted; otherwise only the tag named by ref will be deleted.
func (*TagStore) Get ¶
func (store *TagStore) Get(repoName string) (Repository, error)
Get returns the Repository tag/image map for a given repository.
func (*TagStore) GetImage ¶
GetImage returns a pointer to an Image structure describing the image referred to by refOrID inside repository repoName.
func (*TagStore) GetRepoRefs ¶
GetRepoRefs returns a map with image IDs as keys, and slices listing repo/tag references as the values. It covers all repositories.
func (*TagStore) History ¶
func (s *TagStore) History(name string) ([]*types.ImageHistory, error)
History returns a slice of ImageHistory structures for the specified image name by walking the image lineage.
func (*TagStore) ImageExport ¶
ImageExport exports list of images to a output stream specified in the config. The exported images are archived into a tar when written to the output stream. All images with the given tag and all versions containing the same tag are exported. names is the set of tags to export, and outStream is the writer which the images are written to.
func (*TagStore) ImageTarLayer ¶
ImageTarLayer return the tarLayer of the image
func (*TagStore) Images ¶
Images returns a filtered list of images. filterArgs is a JSON-encoded set of filter arguments which will be interpreted by pkg/parsers/filters. filter is a shell glob string applied to repository names. The argument named all controls whether all images in the graph are filtered, or just the heads.
func (*TagStore) Import ¶
func (s *TagStore) Import(src string, repo string, tag string, inConfig io.ReadCloser, outStream io.Writer, containerConfig *runconfig.Config) error
Import imports an image, getting the archived layer data either from inConfig (if src is "-"), or from a URI specified in src. Progress output is written to outStream. Repository and tag names can optionally be given in the repo and tag arguments, respectively.
func (*TagStore) Load ¶
Load uploads a set of images into the repository. This is the complementary of ImageExport. The input stream is an uncompressed tar ball containing images and metadata.
func (*TagStore) Lookup ¶
func (s *TagStore) Lookup(name string) (*types.ImageInspect, error)
Lookup looks up an image by name in a TagStore and returns it as an ImageInspect structure.
func (*TagStore) LookupImage ¶
LookupImage returns pointer to an Image struct corresponding to the given name. The name can include an optional tag; otherwise the default tag will be used.
func (*TagStore) NewPusher ¶
func (s *TagStore) NewPusher(endpoint registry.APIEndpoint, localRepo Repository, repoInfo *registry.RepositoryInfo, imagePushConfig *ImagePushConfig, sf *streamformatter.StreamFormatter) (Pusher, error)
NewPusher creates a new Pusher interface that will push to either a v1 or v2 registry. The endpoint argument contains a Version field that determines whether a v1 or v2 pusher will be created. The other parameters are passed through to the underlying pusher implementation for use during the actual push operation.
func (*TagStore) Pull ¶
func (s *TagStore) Pull(image string, tag string, imagePullConfig *ImagePullConfig) error
Pull initiates a pull operation. image is the repository name to pull, and tag may be either empty, or indicate a specific tag to pull.
func (*TagStore) Push ¶
func (s *TagStore) Push(localName string, imagePushConfig *ImagePushConfig) error
Push initiates a push operation on the repository named localName.
type TagStoreConfig ¶
type TagStoreConfig struct { // Graph is the versioned image store Graph *Graph // Key is the private key to use for signing manifests. Key libtrust.PrivateKey // Registry is the registry service to use for TLS configuration and // endpoint lookup. Registry *registry.Service // Events is the events service to use for logging. Events *events.Events // Trust is the trust service to use for push and pull operations. Trust *trust.TrustStore }
TagStoreConfig provides parameters for a new TagStore.