docker-1.8: Index | Files

package graph

import ""


Package Files

export.go graph.go graph_unix.go history.go import.go list.go list_v1.go list_v2.go load.go mutex.go pull.go pull_v1.go pull_v2.go push.go push_v1.go push_v2.go registry.go service.go service_v1.go service_v2.go tags.go


const DEFAULTTAG = "latest"
const MaxImageDepth = 127

Set the max depth to the aufs default that most kernels are compiled with For more information see:


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")

func NewV2Repository Uses

func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint, metaHeaders http.Header, authConfig *cliconfig.AuthConfig) (distribution.Repository, error)

v2 only

func SetupInitLayer Uses

func SetupInitLayer(initLayer string) error

setupInitLayer populates a directory with mountpoints suitable for bind-mounting dockerinit into the container. The mountpoint is simply an empty file at /.dockerinit

This extra layer is used by all containers as the top-most ro layer. It protects the container from unwanted side-effects on the rw layer.

func WriteStatus Uses

func WriteStatus(requestedTag string, out io.Writer, sf *streamformatter.StreamFormatter, layersDownloaded bool)

type ByCreated Uses

type ByCreated []*types.Image

func (ByCreated) Len Uses

func (r ByCreated) Len() int

func (ByCreated) Less Uses

func (r ByCreated) Less(i, j int) bool

func (ByCreated) Swap Uses

func (r ByCreated) Swap(i, j int)

type Graph Uses

type Graph struct {
    // contains filtered or unexported fields

A Graph is a store for versioned filesystem images and the relationship between them.

func NewGraph Uses

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 Uses

func (graph *Graph) ByParent() map[string][]*image.Image

ByParent returns a lookup table of images by their parent. If an image of id 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 Uses

func (graph *Graph) CheckDepth(img *image.Image) error

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 Uses

func (graph *Graph) Create(layerData archive.ArchiveReader, 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) Delete Uses

func (graph *Graph) Delete(name string) error

Delete atomically removes an image from the graph.

func (*Graph) Exists Uses

func (graph *Graph) Exists(id string) bool

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 Uses

func (graph *Graph) Get(name string) (*image.Image, error)

Get returns the image with the given id, or an error if the image doesn't exist.

func (*Graph) GetDigest Uses

func (graph *Graph) GetDigest(id string) (digest.Digest, error)

GetDigest gets the digest for the provide image layer id.

func (*Graph) GetParent Uses

func (graph *Graph) GetParent(img *image.Image) (*image.Image, error)

func (*Graph) GetParentsSize Uses

func (graph *Graph) GetParentsSize(img *image.Image, size int64) int64

func (*Graph) Heads Uses

func (graph *Graph) Heads() map[string]*image.Image

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 Uses

func (graph *Graph) IsHeld(layerID string) bool

IsHeld returns whether the given layerID is being used by an ongoing pull or build.

func (*Graph) IsNotExist Uses

func (graph *Graph) IsNotExist(err error, id string) bool

FIXME: Implement error subclass instead of looking at the error text Note: This is the way golang implements os.IsNotExists on Plan9

func (*Graph) Map Uses

func (graph *Graph) Map() map[string]*image.Image

Map returns a list of all images in the graph, addressable by ID.

func (*Graph) RawJSON Uses

func (graph *Graph) RawJSON(id string) ([]byte, error)

RawJSON returns the JSON representation for an image as a byte array.

func (*Graph) Register Uses

func (graph *Graph) Register(img *image.Image, layerData archive.ArchiveReader) (err error)

Register imports a pre-existing image into the graph.

func (*Graph) Release Uses

func (graph *Graph) Release(sessionID string, layerIDs ...string)

Release removes the referenced image id from the provided set of layers.

func (*Graph) Retain Uses

func (graph *Graph) Retain(sessionID string, layerIDs ...string)

If the images and layers are in pulling chain, retain them. If not, they may be deleted by rmi with dangling condition.

func (*Graph) SetDigest Uses

func (graph *Graph) SetDigest(id string, dgst digest.Digest) error

SetDigest sets the digest for the image layer to the provided value.

func (*Graph) TarLayer Uses

func (graph *Graph) TarLayer(img *image.Image) (arch archive.Archive, err error)

TarLayer returns a tar archive of the image's filesystem layer.

func (*Graph) TempLayerArchive Uses

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.

func (*Graph) WalkHistory Uses

func (graph *Graph) WalkHistory(img *image.Image, handler func(image.Image) error) (err error)

WalkHistory calls the handler function for each image in the provided images lineage starting from immediate parent.

type ImageExportConfig Uses

type ImageExportConfig struct {
    Names     []string
    Outstream io.Writer

CmdImageExport exports all images with the given tag. All versions containing the same tag are exported. The resulting output is an uncompressed tar ball. name is the set of tags to export. out is the writer where the images are written to.

type ImageImportConfig Uses

type ImageImportConfig struct {
    Changes         []string
    InConfig        io.ReadCloser
    OutStream       io.Writer
    ContainerConfig *runconfig.Config

type ImagePullConfig Uses

type ImagePullConfig struct {
    MetaHeaders map[string][]string
    AuthConfig  *cliconfig.AuthConfig
    OutStream   io.Writer

type ImagePushConfig Uses

type ImagePushConfig struct {
    MetaHeaders map[string][]string
    AuthConfig  *cliconfig.AuthConfig
    Tag         string
    Force       bool
    OutStream   io.Writer

type ImagesConfig Uses

type ImagesConfig struct {
    Filters string
    Filter  string
    All     bool

type LookupRemoteConfig Uses

type LookupRemoteConfig struct {
    MetaHeaders map[string][]string
    AuthConfig  *cliconfig.AuthConfig

LookupRemoteConfig allows you to pass transport-related data to LookupRemote function.

type ManifestFetcher Uses

type ManifestFetcher interface {
    Fetch(ref string) (imgInspect *types.RemoteImageInspect, fallback bool, err error)

ManifestFetcher allows to pull image's json without any binary blobs.

func NewManifestFetcher Uses

func NewManifestFetcher(s *TagStore, endpoint registry.APIEndpoint, repoInfo *registry.RepositoryInfo, config *LookupRemoteConfig) (ManifestFetcher, error)

NewManifestFetcher creates appropriate fetcher instance for given endpoint.

type Puller Uses

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)

func NewPuller Uses

func NewPuller(s *TagStore, endpoint registry.APIEndpoint, repoInfo *registry.RepositoryInfo, imagePullConfig *ImagePullConfig, sf *streamformatter.StreamFormatter) (Puller, error)

type Pusher Uses

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)

type RemoteTagsConfig Uses

type RemoteTagsConfig struct {
    MetaHeaders map[string][]string
    AuthConfig  *cliconfig.AuthConfig

RemoteTagsConfig allows to specify transport paramater for remote ta listing.

type Repository Uses

type Repository map[string]string

func (Repository) Contains Uses

func (r Repository) Contains(u Repository) bool

return true if the contents of u Repository, are wholly contained in r Repository

func (Repository) Update Uses

func (r Repository) Update(u Repository)

update Repository mapping with content of u

type TagLister Uses

type TagLister interface {
    ListTags() (tagList []*types.RepositoryTag, fallback bool, err error)

TagLister allows to list tags of remote repository.

func NewTagLister Uses

func NewTagLister(s *TagStore, endpoint registry.APIEndpoint, repoInfo *registry.RepositoryInfo, config *RemoteTagsConfig) (TagLister, error)

NewTagLister creates a specific tag lister for given endpoint.

type TagStore Uses

type TagStore struct {
    Repositories map[string]Repository


    ConfirmDefPush bool
    // contains filtered or unexported fields

func NewTagStore Uses

func NewTagStore(path string, cfg *TagStoreConfig) (*TagStore, error)

func (*TagStore) ByID Uses

func (store *TagStore) ByID() map[string][]string

Return a reverse-lookup table of all the names which refer to each image Eg. {"43b5f19b10584": {"base:latest", "base:v1"}}

func (*TagStore) Delete Uses

func (store *TagStore) Delete(repoName, ref string) (bool, error)

func (*TagStore) DeleteAll Uses

func (store *TagStore) DeleteAll(id string) error

func (*TagStore) Get Uses

func (store *TagStore) Get(repoName string) (Repository, error)

func (*TagStore) GetImage Uses

func (store *TagStore) GetImage(repoName, refOrID string) (*image.Image, error)

func (*TagStore) GetRepoRefs Uses

func (store *TagStore) GetRepoRefs() map[string][]string

func (*TagStore) History Uses

func (s *TagStore) History(name string) ([]*types.ImageHistory, error)

func (*TagStore) ImageExport Uses

func (s *TagStore) ImageExport(imageExportConfig *ImageExportConfig) error

func (*TagStore) ImageName Uses

func (store *TagStore) ImageName(id string) string

func (*TagStore) ImageTarLayer Uses

func (s *TagStore) ImageTarLayer(name string, dest io.Writer) error

ImageTarLayer return the tarLayer of the image

func (*TagStore) Images Uses

func (s *TagStore) Images(config *ImagesConfig) ([]*types.Image, error)

func (*TagStore) Import Uses

func (s *TagStore) Import(src string, repo string, tag string, imageImportConfig *ImageImportConfig) error

func (*TagStore) Load Uses

func (s *TagStore) Load(inTar io.ReadCloser, outStream io.Writer) error

Loads 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 Uses

func (s *TagStore) Lookup(name string) (*types.ImageInspect, error)

Lookup return an image encoded in JSON

func (*TagStore) LookupImage Uses

func (store *TagStore) LookupImage(name string) (*image.Image, error)

func (*TagStore) LookupRaw Uses

func (s *TagStore) LookupRaw(name string) ([]byte, error)

func (*TagStore) LookupRemote Uses

func (s *TagStore) LookupRemote(name, ref string, config *LookupRemoteConfig) (*types.RemoteImageInspect, error)

LookupRemote returns metadata for remote image.

func (*TagStore) NewPusher Uses

func (s *TagStore) NewPusher(endpoint registry.APIEndpoint, localRepo Repository, repoInfo *registry.RepositoryInfo, imagePushConfig *ImagePushConfig, sf *streamformatter.StreamFormatter) (Pusher, error)

func (*TagStore) NormalizeLocalName Uses

func (store *TagStore) NormalizeLocalName(name string) string

NormalizeLocalName returns local name for given image if it doesn't exist. Id of existing local image won't be changed.

func (*TagStore) Pull Uses

func (s *TagStore) Pull(image string, tag string, imagePullConfig *ImagePullConfig) error

func (*TagStore) Push Uses

func (s *TagStore) Push(localName string, imagePushConfig *ImagePushConfig) error

FIXME: Allow to interrupt current push when new push of same image is done.

func (*TagStore) RemoteTags Uses

func (s *TagStore) RemoteTags(name string, config *RemoteTagsConfig) (*types.RepositoryTagList, error)

RemoteTags fetches a tag list from remote repository

func (*TagStore) SetDigest Uses

func (store *TagStore) SetDigest(repoName, digest, imageName string, keepUnqualified bool) error

SetDigest creates a digest reference to an image ID.

func (*TagStore) SetLoad Uses

func (store *TagStore) SetLoad(repoName, tag, imageName string, force, keepUnqualified bool, out io.Writer) error

func (*TagStore) Tag Uses

func (store *TagStore) Tag(repoName, tag, imageName string, force, keepUnqualified bool) error

Tag creates a tag in the repository reponame, pointing to the image named imageName. If force is true, an existing tag with the same name may be overwritten. Default repository will be prepend to unqualified repoName unless keepUnqualified is true.

func (*TagStore) Tags Uses

func (s *TagStore) Tags(name string) (*types.RepositoryTagList, error)

Tags returns a tag list for given local repository.

type TagStoreConfig Uses

type TagStoreConfig struct {
    Graph          *Graph
    Key            libtrust.PrivateKey
    Registry       *registry.Service
    Events         *events.Events
    Trust          *trust.TrustStore
    ConfirmDefPush bool

Package graph imports 52 packages (graph). Updated 2019-08-24. Refresh now. Tools for package owners.