container

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatPorts

func FormatPorts(ports []Port) string

FormatPorts renders ports as host→container, e.g. "8888→8080, 53/udp". The container port is left out if it equals the host port, the protocol unless it is udp or sctp.

Types

type Details

type Details struct {
	ID      string
	Name    string
	Image   string
	ImageID string
	Created time.Time

	State      string
	Pid        int
	ExitCode   int
	OOMKilled  bool
	Error      string
	StartedAt  time.Time
	FinishedAt time.Time

	// RestartPolicy is e.g. "always" or "on-failure:5".
	RestartPolicy string
	RestartCount  int

	Entrypoint []string
	Cmd        []string
	WorkingDir string
	User       string

	// Health is nil if the container has no healthcheck.
	Health *Health

	Networks []Network
	// Ports holds the exposed ports; Public is 0 for those not published on
	// the host.
	Ports  []Port
	Mounts []Mount

	Resources Resources

	// Env holds the environment as KEY=value pairs.
	Env    []string
	Labels map[string]string
}

Details is the inspect information of a single container. Zero values mean the daemon didn't report the field or it isn't set.

type Health

type Health struct {
	Status        string
	FailingStreak int
	// Checks holds the most recent checks, oldest first.
	Checks []HealthCheck
}

Health is the state of a container's healthcheck.

type HealthCheck

type HealthCheck struct {
	Start    time.Time
	ExitCode int
	Output   string
}

HealthCheck is the result of a single healthcheck run.

type Mount

type Mount struct {
	Type        string
	Source      string
	Destination string
	RW          bool
}

Mount is a volume, bind or tmpfs mounted into the container.

type Network

type Network struct {
	Name    string
	IP      string
	Gateway string
	MAC     string
	Aliases []string
}

Network is a container's endpoint in a Docker network.

type Port

type Port struct {
	Public  uint16
	Private uint16
	Proto   string
}

Port is a container port published on the host.

type Resources

type Resources struct {
	Memory    int64 // bytes
	NanoCPUs  int64
	CPUShares int64
	PidsLimit int64
	Ulimits   []Ulimit
}

Resources are the limits set on a container; 0 means unlimited.

type Short

type Short struct {
	ID string
	// Project is the compose project, empty if the container wasn't started
	// by compose.
	Project string
	Name    string
	Image   string
	Ports   []Port
	Status  string
	Age     string
	State   string
	// Health is "healthy", "unhealthy", "starting" or "none" if the container
	// has no healthcheck. It is empty if the daemon doesn't report health.
	Health string
}

type Stats

type Stats struct {
	Read time.Time

	// CPUPercent is the CPU usage since the previous sample, where 100 is
	// one full CPU; it goes up to 100 times OnlineCPUs.
	CPUPercent float64
	OnlineCPUs int

	// MemUsage excludes the page cache, like docker stats does.
	MemUsage uint64 // bytes
	MemLimit uint64 // bytes

	// NetRx and NetTx are the bytes received and sent since the container
	// started, summed over all interfaces.
	NetRx uint64
	NetTx uint64
}

Stats is one sample of a container's resource usage. Read is zero if the container isn't running, in which case all other fields are zero too.

type Ulimit

type Ulimit struct {
	Name       string
	Soft, Hard int64
}

Ulimit is a resource limit of the container's processes.

Jump to

Keyboard shortcuts

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