docker

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WildcardAlias = "*"

	NSProxy = "proxy"

	LabelAliases       = NSProxy + ".aliases"
	LabelExclude       = NSProxy + ".exclude"
	LabelIdleTimeout   = NSProxy + ".idle_timeout"
	LabelWakeTimeout   = NSProxy + ".wake_timeout"
	LabelStopMethod    = NSProxy + ".stop_method"
	LabelStopTimeout   = NSProxy + ".stop_timeout"
	LabelStopSignal    = NSProxy + ".stop_signal"
	LabelStartEndpoint = NSProxy + ".start_endpoint"
)

Variables

View Source
var DummyContainer = new(Container)
View Source
var ErrInvalidLabel = gperr.New("invalid label")

Functions

func Clients added in v0.11.0

func Clients() map[string]*SharedClient

func IsErrConnectionFailed

func IsErrConnectionFailed(err error) bool

func ListContainers

func ListContainers(clientHost string) ([]container.SummaryTrimmed, error)

Types

type Container

type Container struct {
	DockerHost    string          `json:"docker_host"`
	Image         *ContainerImage `json:"image"`
	ContainerName string          `json:"container_name"`
	ContainerID   string          `json:"container_id"`

	Agent *agent.AgentConfig `json:"agent"`

	Labels            map[string]string   `json:"-"`
	IdlewatcherConfig *idlewatcher.Config `json:"idlewatcher_config"`

	Mounts []string `json:"mounts"`

	PublicPortMapping  PortMapping `json:"public_ports"`  // non-zero publicPort:types.Port
	PrivatePortMapping PortMapping `json:"private_ports"` // privatePort:types.Port
	PublicHostname     string      `json:"public_hostname"`
	PrivateHostname    string      `json:"private_hostname"`

	Aliases    []string `json:"aliases"`
	IsExcluded bool     `json:"is_excluded"`
	IsExplicit bool     `json:"is_explicit"`
	Running    bool     `json:"running"`
	// contains filtered or unexported fields
}

func FromDocker

func FromDocker(c *container.SummaryTrimmed, dockerHost string) (res *Container)

func (*Container) IsBlacklisted added in v0.10.0

func (c *Container) IsBlacklisted() bool

type ContainerImage added in v0.10.0

type ContainerImage struct {
	Author string `json:"author,omitempty"`
	Name   string `json:"name"`
	Tag    string `json:"tag,omitempty"`
}

func (*ContainerImage) IsBlacklisted added in v0.10.0

func (image *ContainerImage) IsBlacklisted() bool

type LabelMap

type LabelMap = map[string]any

func ParseLabels

func ParseLabels(labels map[string]string) (LabelMap, gperr.Error)

type PortMapping

type PortMapping = map[int]container.Port

type SharedClient

type SharedClient struct {
	*client.Client
	// contains filtered or unexported fields
}

func NewClient added in v0.10.0

func NewClient(host string) (*SharedClient, error)

NewClient creates a new Docker client connection to the specified host.

Returns existing client if available.

Parameters:

  • host: the host to connect to (either a URL or common.DockerHostFromEnv).

Returns:

  • Client: the Docker client connection.
  • error: an error if the connection failed.

func (*SharedClient) Address added in v0.10.0

func (c *SharedClient) Address() string

func (*SharedClient) CheckConnection added in v0.10.0

func (c *SharedClient) CheckConnection(ctx context.Context) error

func (*SharedClient) Close

func (c *SharedClient) Close()

if the client is still referenced, this is no-op.

func (*SharedClient) Key added in v0.11.0

func (c *SharedClient) Key() string

Jump to

Keyboard shortcuts

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