context

package
v0.0.0-...-aeb97f1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentContainerID

func GetCurrentContainerID(filepaths ...string) (id string)

GetCurrentContainerID attempts to extract the current container ID from the provided file paths. If no files paths are provided, it will default to /proc/1/cpuset, /proc/self/cgroup and /proc/self/mountinfo. It attempts to match the HOSTNAME first then use the fallback method, and returns with the first valid match.

func SetDockerEnv

func SetDockerEnv(d *docker.Env)

func SetServerInfo

func SetServerInfo(d *docker.DockerInfo)

Types

type Address

type Address struct {
	IP           string
	IP6LinkLocal string
	IP6Global    string
	Port         string
	HostPort     string
	Proto        string
	HostIP       string
}

func GetContainerAddresses

func GetContainerAddresses(container *docker.Container) []Address

type Context

type Context []*RuntimeContainer

func (*Context) Docker

func (c *Context) Docker() Docker

func (*Context) Env

func (c *Context) Env() map[string]string

type Docker

type Docker struct {
	Name               string
	NumContainers      int
	NumImages          int
	Version            string
	ApiVersion         string
	GoVersion          string
	OperatingSystem    string
	Architecture       string
	CurrentContainerID string
}

type DockerImage

type DockerImage struct {
	Registry   string
	Repository string
	Tag        string
}

func (*DockerImage) String

func (i *DockerImage) String() string

type Health

type Health struct {
	Status string
}

type Mount

type Mount struct {
	Name        string
	Source      string
	Destination string
	Driver      string
	Mode        string
	RW          bool
}

type Network

type Network struct {
	IP                  string
	Name                string
	Gateway             string
	EndpointID          string
	IPv6Gateway         string
	GlobalIPv6Address   string
	MacAddress          string
	GlobalIPv6PrefixLen int
	IPPrefixLen         int
	Internal            bool
}

type RuntimeContainer

type RuntimeContainer struct {
	ID           string
	Created      time.Time
	Addresses    []Address
	Networks     []Network
	Gateway      string
	Name         string
	Hostname     string
	NetworkMode  string
	Image        DockerImage
	Env          map[string]string
	Volumes      map[string]Volume
	Node         SwarmNode
	Labels       map[string]string
	IP           string
	IP6LinkLocal string
	IP6Global    string
	Mounts       []Mount
	State        State
}

func (*RuntimeContainer) Equals

func (r *RuntimeContainer) Equals(o RuntimeContainer) bool

func (*RuntimeContainer) PublishedAddresses

func (r *RuntimeContainer) PublishedAddresses() []Address

type State

type State struct {
	Running bool
	Health  Health
}

type SwarmNode

type SwarmNode struct {
	ID      string
	Name    string
	Address Address
}

type Volume

type Volume struct {
	Path      string
	HostPath  string
	ReadWrite bool
}

Jump to

Keyboard shortcuts

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