docker

package
v0.0.0-...-64e30f5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WildcardAlias = "*"

	NSProxy    = "proxy"
	NSHomePage = "homepage"

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

Variables

This section is empty.

Functions

func ApplyLabel

func ApplyLabel[T any](obj *T, l *Label) E.NestedError

Apply applies the value of a Label to the corresponding field in the given object.

Parameters:

  • obj: a pointer to the object to which the Label value will be applied.
  • l: a pointer to the Label containing the attribute and value to be applied.

Returns:

  • error: an error if the field does not exist.

func CloseAllClients

func CloseAllClients()

func IsErrConnectionFailed

func IsErrConnectionFailed(err error) bool

Types

type Client

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

func ConnectClient

func ConnectClient(host string) (Client, E.NestedError)

ConnectClient 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 (*Client) Close

func (c *Client) Close() error

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

func (Client) Connected

func (c Client) Connected() bool

func (Client) Inspect

func (c Client) Inspect(containerID string) (*Container, E.NestedError)

type ClientInfo

type ClientInfo struct {
	Client     Client
	Containers []types.Container
}

func GetClientInfo

func GetClientInfo(clientHost string, getContainer bool) (*ClientInfo, E.NestedError)

type Container

type Container struct {
	DockerHost    string `json:"docker_host" yaml:"-"`
	ContainerName string `json:"container_name" yaml:"-"`
	ContainerID   string `json:"container_id" yaml:"-"`
	ImageName     string `json:"image_name" yaml:"-"`

	Labels map[string]string `json:"labels" yaml:"-"`

	PublicPortMapping  PortMapping `json:"public_ports" yaml:"-"`  // non-zero publicPort:types.Port
	PrivatePortMapping PortMapping `json:"private_ports" yaml:"-"` // privatePort:types.Port
	PublicIP           string      `json:"public_ip" yaml:"-"`
	PrivateIP          string      `json:"private_ip" yaml:"-"`
	NetworkMode        string      `json:"network_mode" yaml:"-"`

	Aliases     []string `json:"aliases" yaml:"-"`
	IsExcluded  bool     `json:"is_excluded" yaml:"-"`
	IsExplicit  bool     `json:"is_explicit" yaml:"-"`
	IsDatabase  bool     `json:"is_database" yaml:"-"`
	IdleTimeout string   `json:"idle_timeout" yaml:"-"`
	WakeTimeout string   `json:"wake_timeout" yaml:"-"`
	StopMethod  string   `json:"stop_method" yaml:"-"`
	StopTimeout string   `json:"stop_timeout" yaml:"-"` // stop_method = "stop" only
	StopSignal  string   `json:"stop_signal" yaml:"-"`  // stop_method = "stop" | "kill" only
	Running     bool     `json:"running" yaml:"-"`
	// contains filtered or unexported fields
}

func FromDocker

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

func FromJSON

func FromJSON(json types.ContainerJSON, dockerHost string) *Container

type Label

type Label struct {
	Namespace string
	Target    string
	Attribute string
	Value     any
}

Formats:

  • namespace.attribute
  • namespace.target.attribute
  • namespace.target.attribute.namespace2.attribute

func ParseLabel

func ParseLabel(label string, value string) (*Label, E.NestedError)

func (*Label) String

func (l *Label) String() string

type NestedLabelMap

type NestedLabelMap map[string]U.SerializedObject

Formats:

  • namespace.attribute
  • namespace.target.attribute
  • namespace.target.attribute.namespace2.attribute

type PortMapping

type PortMapping = map[string]types.Port

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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