docker

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceKindHost           = "host"
	ResourceKindContainer      = "container"
	ResourceKindSwarmTask      = "swarm/task"
	ResourceKindSwarmService   = "swarm/service"
	ResourceKindSwarmNamespace = "swarm/namespace"
	ResourceKindComposeProject = "compose/project"
	ResourceKindComposeService = "compose/service"
)

Variables

This section is empty.

Functions

func TagName

func TagName(kind ResourceKind) string

TagName returns the human-readable name of a tag representing the resource. Panics if ResourceKind.IsSupported returns false.

Types

type ConfigEntry added in v0.16.0

type ConfigEntry struct {
	Auth     string `json:"auth,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
	Email    string `json:"email,omitempty"`
}

ConfigEntry is an entry for a specific pattern, as defined in a ConfigFile.

type ConfigFile added in v0.16.0

type ConfigFile struct {
	Auths       map[string]ConfigEntry `json:"auths"`
	HttpHeaders map[string]string      `json:"HttpHeaders,omitempty"`
}

ConfigFile implements config file format used by Docker (and Kubernetes) for registry secrets and auth.

type Container

type Container struct {
	ID      string `json:"Id"`
	Names   []string
	Image   string
	ImageID string
	Labels  map[string]string
}

Container is a container as defined by the Docker runtime API.

func (Container) Name

func (c Container) Name() string

Name returns the name of the container, or its ID if no name is found.

type GetContainersOptions

type GetContainersOptions struct {
	// All maps to the all query parameter of the containers API, returning all
	// containers no matter their state.
	All bool
	// Filters maps to the filters query parameter of the containers API,
	// filtering containers to include.
	Filters map[string][]string
}

type Image

type Image struct {
	ID          string `json:"Id"`
	RepoTags    []string
	RepoDigests []string
}

Image is an image as defined by the Docker runtime API.

type Options

type Options struct {
	// IncludeAllContainers will graph all containers, no matter their state.
	// Defaults to false - only include running containers.
	IncludeAllContainers bool
	// TLSClientConfig sets the TLSClientConfig of the underlying client.
	// Only used if scheme is tcp or https.
	TLSClientConfig *tls.Config
}

type Platform

type Platform struct {
	// contains filtered or unexported fields
}

Platform implements graphing for the Docker platform.

func NewPlatform

func NewPlatform(ctx context.Context, dockerURI string, options *Options) (*Platform, error)

NewPlatform initializes a new Platform.

func (*Platform) GetContainers

func (p *Platform) GetContainers(ctx context.Context, options *GetContainersOptions) ([]Container, error)

GetContainers retrieves container information from the Docker runtime.

func (*Platform) GetImage

func (p *Platform) GetImage(ctx context.Context, nameOrID string) (*Image, error)

GetImage retrieves container image information from the Docker runtime by name or id. Returns an error if the image does not exist.

func (*Platform) Graph

func (p *Platform) Graph(ctx context.Context) (*graph.Graph[platform.Node], error)

Graph implements platform.Platform.

SEE: https://docs.docker.com/reference/api/engine/version/v1.47/

func (*Platform) Version added in v0.20.0

func (p *Platform) Version() Version

Version returns the version of the platform.

type Resource

type Resource interface {
	platform.Node
	// Kind returns the type of resource.
	Kind() ResourceKind
	// Name returns the name of the resource.
	Name() string
	// String returns a textual representation of the resource.
	String() string
}

Resource is a Docker resource found on the platform.

type ResourceKind

type ResourceKind string

ResourceKind defines the types of resources exposed by the platform.

func (ResourceKind) IsSupported added in v0.18.0

func (r ResourceKind) IsSupported() bool

IsSupported returns whether or not the resource is supported.

type Version added in v0.20.0

type Version struct {
	// Version is the version of Docker.
	Version      string `json:"Version"`
	OS           string `json:"Os"`
	Architecture string `json:"Arch"`
	// MinimumAPIVersion is the minimum support API version.
	MinimumAPIVersion string `json:"MinAPIVersion"`
	// APIVersion is the current API version.
	APIVersion string `json:"ApiVersion"`
}

Jump to

Keyboard shortcuts

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