Documentation
¶
Overview ¶
Package common provides shared types, utilities, and constants.
Index ¶
- Constants
- Variables
- func AndroidEnv() []string
- func AppDataDir() string
- func ArgsEscaped(args []string) bool
- func CommandExists(cmd string) bool
- func ContainerDir() string
- func ContainerID() string
- func ContainsString(slice []string, s string) bool
- func CopyDir(src, dst string) error
- func DataDir() string
- func DefaultCRISocket() string
- func DefaultDaemonSocket() string
- func EnsureDir(path string) error
- func FullVersion() string
- func GenerateID(length int) string
- func HasLibTermuxExec() bool
- func HasSystemd() bool
- func ImageDir() string
- func InternString(s string) string
- func IsConflict(err error) bool
- func IsNotFound(err error) bool
- func IsProotMode() bool
- func IsSensitiveBindSource(source string) bool
- func IsTermux() bool
- func LogDir() string
- func MergeEnv(base, overrides []string) []string
- func NetworkDir() string
- func NewErrConflict(resource, id string) error
- func NewErrInvalidParam(param, message string) error
- func NewErrNotFound(resource, id string) error
- func NowTimestamp() int64
- func OSType() string
- func ParseEnv(env string) (string, string)
- func ParsePortBinding(binding string) (Port, PortBinding, error)
- func PathExists(path string) bool
- func ProotContainerIP(logicalIP string) string
- func RemoveString(slice []string, s string) []string
- func ResolvePath(base, path string) string
- func RuntimeDir() string
- func SafeFileMode(v int64) os.FileMode
- func SafeInt64FromUint64(v uint64) int64
- func SafeUint32FromInt64(v int64) uint32
- func SafeUint64FromInt64(v int64) uint64
- func SaveConfig(cfg *DokiConfig) error
- func SecureJoin(root, unsafePath string) (string, error)
- func ShortID(id string) string
- func SplitStrSlice(s string) []string
- func StripHostEnv(env []string) []string
- func StripHostEnvFromOS() []string
- func SystemdListenFDs() []*os.File
- func TermuxLibPath() string
- func TermuxPrefix() string
- func TermuxVersion() string
- func TimeToTimestamp(t time.Time) int64
- func TrimQuotes(s string) string
- func UseProotHostNetworking() bool
- func UserAgent() string
- func ValidContainerName(name string) bool
- func ValidateDigest(d string) error
- func ValidateEnv(env []string) []string
- func ValidateEnvVar(name string) bool
- func VolumeDir() string
- func WriteFileSafe(path, content string, mode os.FileMode) error
- type BindOptions
- type ContainerConfig
- type ContainerInfo
- type ContainerJSON
- type ContainerState
- type ContainerStatus
- type DeviceMapping
- type DokiConfig
- type DriverConfig
- type EndpointIPAMConfig
- type EndpointResource
- type EndpointSettings
- type ErrConflict
- type ErrContainerPaused
- type ErrContainerStopped
- type ErrInvalidParam
- type ErrNotFound
- type ErrNotImplemented
- type ErrPermissionDenied
- type EventActor
- type ExecConfig
- type GraphDriverData
- type HealthCheckResult
- type HealthStatus
- type HostConfig
- type IPAM
- type IPAMConfig
- type ImageInfo
- type ImageRef
- type LogDriver
- type Mount
- type MountPoint
- type MountType
- type NetworkInfo
- type NetworkMode
- type NetworkSettings
- type Port
- type PortBinding
- type PortMap
- type PortProtocol
- type RestartPolicy
- type RestartPolicyConfig
- type SearchResult
- type SystemEventsResponse
- type SystemInfo
- type TmpfsOptions
- type Ulimit
- type VersionInfo
- type VolumeInfo
- type VolumeOptions
Constants ¶
const ( // DefaultConfigDir is where Doki config is stored. DefaultConfigDir = ".doki" // ConfigFileName is the name of the config file. ConfigFileName = "config.json" // DefaultSocketName is the default unix socket name. DefaultSocketName = "doki.sock" )
const DokiAPIVersion = "1.55"
DokiAPIVersion is the compatible Docker Engine API version. Aligned with Docker Engine 29.6.x (June 2026) max API.
const DokiMinClient = "1.44"
DokiMinClient is the minimum API version we accept from clients. Below this we negotiate up.
const DokiVersion = "0.12.0"
DokiVersion is the current version of the Doki engine. v0.12.0: Production-ready unified runtime - Docker 80% / Podman 40% / CRI 75% Full attach/exec hijack, critest passing, Quadlets, Kube Play, OCI Artifacts, nftables/iptables auto-detect, cgroup v2 manager, plugins stubs.
Variables ¶
var ( // Version is the effective runtime version. It defaults to DokiVersion // but is overridden at build time via -ldflags. Version = DokiVersion // GitCommit is the short git commit SHA at build time. "unknown" in dev. GitCommit = "unknown" // BuildDate is the RFC3339 build timestamp. "unknown" in dev. BuildDate = "unknown" // BuildUser is the user that built the binary (from $USER). "unknown" in CI. BuildUser = "unknown" // GoVersion is captured at init() (not via ldflags) to keep the build simple. GoVersion = runtime.Version() )
Build-time injected variables. Override with -ldflags "-X":
-X github.com/OpceanAI/Doki/pkg/common.DokiGitCommit=$(git rev-parse --short HEAD) -X github.com/OpceanAI/Doki/pkg/common.DokiBuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) -X github.com/OpceanAI/Doki/pkg/common.DokiVersion=$(git describe --tags --always --dirty)
Functions ¶
func AndroidEnv ¶ added in v0.9.3
func AndroidEnv() []string
AndroidEnv returns the safe defaults injected into every container's environment. It deliberately uses POSIX paths (/usr/bin, /bin, /root, /tmp) that exist in every glibc and musl based rootfs, instead of Termux-specific paths.
See OpceanAI/Doki#4: without these defaults, the guest sees PREFIX=/data/... and HOME=/data/.../files/home, neither of which exist, so init shells crash on first read of $HOME or $TMPDIR.
func ArgsEscaped ¶
ArgsEscaped checks if command args need shell escaping.
func CommandExists ¶
CommandExists checks if a command exists in PATH.
func ContainsString ¶
ContainsString checks if a slice contains a string.
func DefaultCRISocket ¶ added in v0.11.1
func DefaultCRISocket() string
DefaultCRISocket returns the default Unix socket path for the CRI service.
func DefaultDaemonSocket ¶
func DefaultDaemonSocket() string
DefaultDaemonSocket returns the default daemon socket path.
func FullVersion ¶
func FullVersion() string
FullVersion returns a human-readable banner used in --version and startup logs.
"Doki 0.9.2 (commit a1b2c3d, built 2026-06-02T14:00:00Z by root), API 1.48 (min 1.43)"
func GenerateID ¶
GenerateID generates a random hex ID of the given length.
func HasLibTermuxExec ¶ added in v0.9.3
func HasLibTermuxExec() bool
HasLibTermuxExec reports whether the libtermux-exec-ld-preload.so file is present in the Termux lib directory. Doki uses this to decide whether the workaround (os.Unsetenv("LD_PRELOAD")) is required before launching proot.
func InternString ¶
func IsConflict ¶ added in v0.9.3
IsConflict checks if an error is an ErrConflict.
func IsNotFound ¶ added in v0.9.3
IsNotFound checks if an error is an ErrNotFound.
func IsProotMode ¶ added in v0.9.3
func IsProotMode() bool
IsProotMode reports whether the current process is running under proot. Detection uses three signals in order:
- DOKI_PROOT=1 (explicit override, set by proot runners)
- PROOT_TMP_DIR (libtermux-exec sets this when entering proot)
- Termux + missing /proc/self/cgroup namespace marker (heuristic)
func IsSensitiveBindSource ¶ added in v0.12.0
IsSensitiveBindSource reports whether a host path is too dangerous to expose as a container bind mount source (HIGH-12). Mounting the host root or a system directory read-write is effectively a host takeover, so every API surface that accepts a bind must run its source through this one check.
func NewErrConflict ¶
NewErrConflict creates a new ErrConflict.
func NewErrInvalidParam ¶
NewErrInvalidParam creates a new ErrInvalidParam.
func NewErrNotFound ¶
NewErrNotFound creates a new ErrNotFound.
func ParsePortBinding ¶
func ParsePortBinding(binding string) (Port, PortBinding, error)
ParsePortBinding parses a Docker port binding string like "8080:80/tcp".
func PathExists ¶
PathExists checks if a path exists on the filesystem.
func ProotContainerIP ¶ added in v0.9.3
ProotContainerIP resolves a logical Docker bridge IP (e.g. 172.17.0.2) to the address the host should use to reach the container. In proot+Termux mode this is always 127.0.0.1; elsewhere the original IP is returned.
func RemoveString ¶
RemoveString removes a string from a slice.
func ResolvePath ¶
ResolvePath resolves a path relative to a base directory.
func SafeFileMode ¶ added in v0.10.0
SafeFileMode converts an int64 (e.g. tar.Header.Mode) to os.FileMode without triggering gosec G115. Negative modes collapse to 0.
func SafeInt64FromUint64 ¶ added in v0.10.0
SafeInt64FromUint64 converts a uint64 to int64, clamping values larger than math.MaxInt64 down to math.MaxInt64. Use this anywhere gosec G115 flags an implicit uint64→int64 conversion (disk sizes, file sizes, byte counters).
func SafeUint32FromInt64 ¶ added in v0.10.0
SafeUint32FromInt64 converts an int64 to uint32, treating negative values as zero. Used for tar header mode fields (os.FileMode / syscall mode bits).
func SafeUint64FromInt64 ¶ added in v0.10.0
SafeUint64FromInt64 converts an int64 to uint64, treating negative values as zero. Use this anywhere gosec G115 flags an implicit int64→uint64 conversion (counts, periods, quotas that semantically are non-negative).
func SaveConfig ¶
func SaveConfig(cfg *DokiConfig) error
SaveConfig saves the Doki configuration to disk.
func SecureJoin ¶ added in v0.12.0
SecureJoin resolves unsafePath beneath root, following any symlink components that already exist on disk but clamping every result to root — absolute symlink targets and ".." are interpreted as if root were "/", exactly like a chroot. The returned path is guaranteed to be within root. Trailing components that do not yet exist are appended literally.
This is the defense against symlink-based path-traversal escapes during extraction and container file copy (CVE-2018-15664 class): resolve the PARENT directory of a target through SecureJoin, then join the final path element yourself so an existing symlink at the leaf is replaced rather than followed.
func SplitStrSlice ¶
SplitStrSlice splits a string by commas and trims whitespace.
func StripHostEnv ¶
StripHostEnv removes host-specific environment variables that interfere with proot (ptrace-based container runtime). Notably LD_PRELOAD from Termux hooks execve and breaks proot's ptrace mechanism, and several other Termux/Android variables leak host paths into the guest.
The full deny-list lives in termuxAndroidDenyList. On non-Android hosts the deny-list is harmless because none of the variable names are typically set.
func StripHostEnvFromOS ¶ added in v0.9.3
func StripHostEnvFromOS() []string
StripHostEnvFromOS is a convenience that calls StripHostEnv on the current process environment. It also unsets the denied variables in the process itself so that any child process spawned via exec.Command inherits a clean environment unless cmd.Env is explicitly set.
func SystemdListenFDs ¶
SystemdListenFDs returns file descriptors passed by systemd socket activation.
func TermuxLibPath ¶ added in v0.9.3
func TermuxLibPath() string
TermuxLibPath returns the path where Termux stores its Bionic and libtermux-exec.so. It is the directory the LD_PRELOAD points to, and the path the kernel uses to resolve libtermux-exec.so.1 at exec time.
func TermuxPrefix ¶ added in v0.9.3
func TermuxPrefix() string
TermuxPrefix returns the absolute path of the Termux $PREFIX, falling back to the canonical /data/data/com.termux/files/usr when no env var is set. The returned path always has no trailing slash.
func TermuxVersion ¶ added in v0.9.3
func TermuxVersion() string
TermuxVersion returns the value of $TERMUX_VERSION or "unknown" when the variable is unset. Used for diagnostic output in --doki-trace and in actionable error messages.
func TimeToTimestamp ¶
TimeToTimestamp converts time.Time to Unix timestamp.
func TrimQuotes ¶
TrimQuotes strips surrounding quotes from a string.
func UseProotHostNetworking ¶ added in v0.9.3
func UseProotHostNetworking() bool
UseProotHostNetworking reports whether DokiLink should use host-loopback (127.0.0.1) port forwards instead of bridge IPs. In proot mode the container shares the host netns, so bridge IPs (e.g. 172.17.0.2) are unreachable from the host; loopback works because proot fakes it.
func UserAgent ¶
func UserAgent() string
UserAgent returns the User-Agent string for outbound HTTP requests (registries, OCI distribution, etc.). Mirrors the Docker CLI format.
func ValidContainerName ¶
func ValidateDigest ¶ added in v0.12.0
ValidateDigest reports an error unless d is a strictly formed digest of a supported algorithm. Callers MUST validate every digest that originates from a registry manifest before using it as (part of) a filesystem path.
func ValidateEnv ¶
ValidateEnv validates env vars and applies size limits.
func ValidateEnvVar ¶
ValidateEnvVar checks if an environment variable name is valid per POSIX.
Types ¶
type BindOptions ¶
type BindOptions struct {
Propagation string `json:"Propagation,omitempty"`
NonRecursive bool `json:"NonRecursive,omitempty"`
CreateMountpoint bool `json:"CreateMountpoint,omitempty"`
ReadOnlyNonRecursive bool `json:"ReadOnlyNonRecursive,omitempty"`
ReadOnlyForceRecursive bool `json:"ReadOnlyForceRecursive,omitempty"`
}
BindOptions for bind mounts.
type ContainerConfig ¶
type ContainerConfig struct {
Hostname string `json:"Hostname"`
Domainname string `json:"Domainname"`
User string `json:"User"`
AttachStdin bool `json:"AttachStdin"`
AttachStdout bool `json:"AttachStdout"`
AttachStderr bool `json:"AttachStderr"`
ExposedPorts map[string]struct{} `json:"ExposedPorts"`
Tty bool `json:"Tty"`
OpenStdin bool `json:"OpenStdin"`
StdinOnce bool `json:"StdinOnce"`
Env []string `json:"Env"`
Cmd []string `json:"Cmd"`
Image string `json:"Image"`
Volumes map[string]struct{} `json:"Volumes"`
WorkingDir string `json:"WorkingDir"`
Entrypoint []string `json:"Entrypoint"`
Labels map[string]string `json:"Labels"`
StopSignal string `json:"StopSignal"`
StopTimeout *int `json:"StopTimeout,omitempty"`
Shell []string `json:"Shell"`
}
ContainerConfig holds container-specific configuration.
type ContainerInfo ¶
type ContainerInfo struct {
ID string `json:"Id"`
Name string `json:"Name"`
Image string `json:"Image"`
ImageID string `json:"ImageID"`
Command string `json:"Command"`
Created int64 `json:"Created"`
State ContainerState `json:"State"`
Status string `json:"Status"`
Ports []Port `json:"Ports"`
Labels map[string]string `json:"Labels"`
Names []string `json:"Names"`
SizeRw int64 `json:"SizeRw,omitempty"`
SizeRootFs int64 `json:"SizeRootFs,omitempty"`
HostConfig *HostConfig `json:"HostConfig,omitempty"`
NetworkSettings *NetworkSettings `json:"NetworkSettings,omitempty"`
Mounts []MountPoint `json:"Mounts"`
}
ContainerInfo holds the information about a container.
type ContainerJSON ¶
type ContainerJSON struct {
*ContainerInfo
Config *ContainerConfig `json:"Config"`
HostConfig *HostConfig `json:"HostConfig"`
Image string `json:"Image"`
ImageID string `json:"ImageID"`
Name string `json:"Name"`
ResolvConfPath string `json:"ResolvConfPath"`
HostnamePath string `json:"HostnamePath"`
HostsPath string `json:"HostsPath"`
LogPath string `json:"LogPath"`
RestartCount int `json:"RestartCount"`
Driver string `json:"Driver"`
Platform string `json:"Platform"`
MountLabel string `json:"MountLabel"`
ProcessLabel string `json:"ProcessLabel"`
AppArmorProfile string `json:"AppArmorProfile"`
GraphDriver *GraphDriverData `json:"GraphDriver"`
}
ContainerJSON holds full container information.
type ContainerState ¶
type ContainerState string
ContainerState represents the state of a container.
const ( StateCreated ContainerState = "created" StateRunning ContainerState = "running" StatePaused ContainerState = "paused" StateRestarting ContainerState = "restarting" StateRemoving ContainerState = "removing" StateExited ContainerState = "exited" StateDead ContainerState = "dead" )
type ContainerStatus ¶
type ContainerStatus string
ContainerStatus represents the status string for a container.
const ( StatusCreated ContainerStatus = "created" StatusRunning ContainerStatus = "running" StatusPaused ContainerStatus = "paused" StatusRestarting ContainerStatus = "restarting" StatusRemoving ContainerStatus = "removing" StatusExited ContainerStatus = "exited" StatusDead ContainerStatus = "dead" StatusUp ContainerStatus = "up" )
type DeviceMapping ¶
type DeviceMapping struct {
PathOnHost string `json:"PathOnHost"`
PathInContainer string `json:"PathInContainer"`
CgroupPermissions string `json:"CgroupPermissions"`
}
DeviceMapping represents a device mapping between host and container.
type DokiConfig ¶
type DokiConfig struct {
Root string `json:"root"`
SocketPath string `json:"socket_path"`
StorageDriver string `json:"storage_driver"`
DefaultNetwork string `json:"default_network"`
Debug bool `json:"debug"`
LogLevel string `json:"log_level"`
Rootless bool `json:"rootless"`
DataDir string `json:"data_dir"`
ExecRoot string `json:"exec_root"`
DNS []string `json:"dns"`
DNSSearch []string `json:"dns_search"`
DNSOptions []string `json:"dns_options"`
DefaultUlimits map[string]Ulimit `json:"default_ulimits"`
RegistryMirrors []string `json:"registry_mirrors"`
InsecureRegistries []string `json:"insecure_registries"`
// VM Configuration (doki-OS)
VMImage string `json:"vm_image,omitempty"`
VMCPUs int `json:"vm_cpus,omitempty"`
VMMemoryMB int64 `json:"vm_memory_mb,omitempty"`
VMDiskSizeGB int64 `json:"vm_disk_size_gb,omitempty"`
VMForce bool `json:"vm_force,omitempty"`
}
DokiConfig holds the configuration for the Doki daemon.
func DefaultConfig ¶
func DefaultConfig() *DokiConfig
DefaultConfig returns the default Doki configuration.
func LoadConfig ¶
func LoadConfig() (*DokiConfig, error)
LoadConfig loads the Doki configuration from disk.
func LoadConfigFrom ¶
func LoadConfigFrom(path string) (*DokiConfig, error)
LoadConfigFrom loads the configuration from an explicit file path. Returns a default config with the error wrapped if the file is missing (callers can decide whether to fall back).
type DriverConfig ¶
type DriverConfig struct {
Name string `json:"Name,omitempty"`
Options map[string]string `json:"Options,omitempty"`
}
DriverConfig for volumes.
type EndpointIPAMConfig ¶
type EndpointIPAMConfig struct {
IPv4Address string `json:"IPv4Address,omitempty"`
IPv6Address string `json:"IPv6Address,omitempty"`
}
EndpointIPAMConfig represents IPAM configuration for an endpoint.
type EndpointResource ¶
type EndpointResource struct {
Name string `json:"Name,omitempty"`
EndpointID string `json:"EndpointID"`
MacAddress string `json:"MacAddress"`
IPv4Address string `json:"IPv4Address"`
IPv6Address string `json:"IPv6Address"`
}
EndpointResource contains network resources allocated for an endpoint.
type EndpointSettings ¶
type EndpointSettings struct {
IPAMConfig *EndpointIPAMConfig `json:"IPAMConfig,omitempty"`
Links []string `json:"Links,omitempty"`
Aliases []string `json:"Aliases,omitempty"`
NetworkID string `json:"NetworkID"`
EndpointID string `json:"EndpointID"`
Gateway string `json:"Gateway"`
IPAddress string `json:"IPAddress"`
IPPrefixLen int `json:"IPPrefixLen"`
MacAddress string `json:"MacAddress"`
}
EndpointSettings holds network endpoint configuration.
type ErrConflict ¶
ErrConflict is returned when a resource already exists.
func (*ErrConflict) Error ¶
func (e *ErrConflict) Error() string
func (*ErrConflict) Is ¶
func (e *ErrConflict) Is(target error) bool
type ErrContainerPaused ¶
type ErrContainerPaused struct {
ID string
}
ErrContainerPaused is returned when a container is paused.
func (*ErrContainerPaused) Error ¶
func (e *ErrContainerPaused) Error() string
type ErrContainerStopped ¶
type ErrContainerStopped struct {
ID string
}
ErrContainerStopped is returned when trying to operate on a stopped container.
func (*ErrContainerStopped) Error ¶
func (e *ErrContainerStopped) Error() string
type ErrInvalidParam ¶
ErrInvalidParam is returned when a parameter is invalid.
func (*ErrInvalidParam) Error ¶
func (e *ErrInvalidParam) Error() string
type ErrNotFound ¶
ErrNotFound is returned when a resource is not found.
func (*ErrNotFound) Error ¶
func (e *ErrNotFound) Error() string
func (*ErrNotFound) Is ¶
func (e *ErrNotFound) Is(target error) bool
type ErrNotImplemented ¶
type ErrNotImplemented struct {
Feature string
}
ErrNotImplemented is returned when a feature is not yet implemented.
func (*ErrNotImplemented) Error ¶
func (e *ErrNotImplemented) Error() string
type ErrPermissionDenied ¶
type ErrPermissionDenied struct {
Message string
}
ErrPermissionDenied is returned when permission is denied.
func (*ErrPermissionDenied) Error ¶
func (e *ErrPermissionDenied) Error() string
type EventActor ¶
EventActor describes something that generates events.
type ExecConfig ¶
type ExecConfig struct {
ID string `json:"Id"`
ContainerID string `json:"ContainerID,omitempty"`
AttachStdin bool `json:"AttachStdin"`
AttachStdout bool `json:"AttachStdout"`
AttachStderr bool `json:"AttachStderr"`
Tty bool `json:"Tty"`
Cmd []string `json:"Cmd"`
Env []string `json:"Env"`
WorkingDir string `json:"WorkingDir"`
User string `json:"User"`
Privileged bool `json:"Privileged"`
Running bool `json:"Running"`
ExitCode int `json:"ExitCode"`
Pid int `json:"Pid"`
}
ExecConfig holds configuration for an exec instance.
type GraphDriverData ¶
GraphDriverData holds information about the storage driver.
type HealthCheckResult ¶
type HealthCheckResult struct {
Start time.Time `json:"Start"`
End time.Time `json:"End"`
ExitCode int `json:"ExitCode"`
Output string `json:"Output"`
}
HealthCheckResult stores the result of a healthcheck probe.
type HealthStatus ¶
type HealthStatus struct {
Status string `json:"Status"`
FailingStreak int `json:"FailingStreak"`
Log []HealthCheckResult `json:"Log"`
}
HealthStatus represents the health status.
type HostConfig ¶
type HostConfig struct {
Binds []string `json:"Binds"`
NetworkMode NetworkMode `json:"NetworkMode"`
PortBindings PortMap `json:"PortBindings"`
RestartPolicy RestartPolicyConfig `json:"RestartPolicy"`
AutoRemove bool `json:"AutoRemove"`
Privileged bool `json:"Privileged"`
PublishAllPorts bool `json:"PublishAllPorts"`
ReadonlyRootfs bool `json:"ReadonlyRootfs"`
DNS []string `json:"Dns"`
DNSOptions []string `json:"DnsOptions"`
DNSSearch []string `json:"DnsSearch"`
ExtraHosts []string `json:"ExtraHosts"`
VolumesFrom []string `json:"VolumesFrom"`
CapAdd []string `json:"CapAdd"`
CapDrop []string `json:"CapDrop"`
Sysctls map[string]string `json:"Sysctls"`
ShmSize int64 `json:"ShmSize"`
Tmpfs map[string]string `json:"Tmpfs"`
Ulimits []Ulimit `json:"Ulimits"`
SecurityOpt []string `json:"SecurityOpt"`
Mounts []Mount `json:"Mounts"`
Init bool `json:"Init"`
Runtime string `json:"Runtime"`
Isolation string `json:"Isolation"`
Memory int64 `json:"Memory"`
NanoCpus int64 `json:"NanoCpus"`
CgroupParent string `json:"CgroupParent"`
BlkioWeight uint16 `json:"BlkioWeight"`
PidsLimit int64 `json:"PidsLimit"`
OomKillDisable bool `json:"OomKillDisable"`
OomScoreAdj int64 `json:"OomScoreAdj"`
}
HostConfig is the host-dependent container configuration.
type IPAM ¶
type IPAM struct {
Driver string `json:"Driver"`
Options map[string]string `json:"Options,omitempty"`
Config []IPAMConfig `json:"Config"`
}
IPAM represents IP address management configuration.
type IPAMConfig ¶
type IPAMConfig struct {
Subnet string `json:"Subnet,omitempty"`
Gateway string `json:"Gateway,omitempty"`
IPRange string `json:"IPRange,omitempty"`
}
IPAMConfig represents IPAM configuration for a network.
type ImageInfo ¶
type ImageInfo struct {
ID string `json:"Id"`
RepoTags []string `json:"RepoTags"`
RepoDigests []string `json:"RepoDigests"`
Parent string `json:"Parent"`
Comment string `json:"Comment"`
Created int64 `json:"Created"`
Container string `json:"Container"`
Size int64 `json:"Size"`
VirtualSize int64 `json:"VirtualSize"`
Author string `json:"Author"`
Architecture string `json:"Architecture"`
Os string `json:"Os"`
Labels map[string]string `json:"Labels"`
}
ImageInfo holds information about an image.
type ImageRef ¶
ImageRef represents a parsed image reference.
func ParseImageRef ¶
ParseImageRef parses a Docker image reference string into its components.
func ParseImageRefString ¶
ParseImageRefString parses an image reference. Supports formats: name, name:tag, registry/name, registry/name:tag, registry:port/name, registry:port/name:tag, name@digest, name:tag@digest
type Mount ¶
type Mount struct {
Type MountType `json:"Type"`
Source string `json:"Source,omitempty"`
Target string `json:"Target"`
ReadOnly bool `json:"ReadOnly,omitempty"`
Consistency string `json:"Consistency,omitempty"`
BindOptions *BindOptions `json:"BindOptions,omitempty"`
VolumeOptions *VolumeOptions `json:"VolumeOptions,omitempty"`
TmpfsOptions *TmpfsOptions `json:"TmpfsOptions,omitempty"`
}
Mount represents a mount point inside a container.
type MountPoint ¶
type MountPoint struct {
Type MountType `json:"Type"`
Name string `json:"Name,omitempty"`
Source string `json:"Source"`
Destination string `json:"Destination"`
Driver string `json:"Driver,omitempty"`
Mode string `json:"Mode"`
RW bool `json:"RW"`
Propagation string `json:"Propagation,omitempty"`
}
MountPoint describes a mount point inside a container.
type NetworkInfo ¶
type NetworkInfo struct {
ID string `json:"Id"`
Name string `json:"Name"`
Driver string `json:"Driver"`
Scope string `json:"Scope"`
Internal bool `json:"Internal"`
EnableIPv6 bool `json:"EnableIPv6"`
IPAM *IPAM `json:"IPAM"`
Options map[string]string `json:"Options"`
Labels map[string]string `json:"Labels"`
Containers map[string]EndpointResource `json:"Containers"`
Created time.Time `json:"Created"`
}
NetworkInfo holds information about a network.
type NetworkMode ¶
type NetworkMode string
NetworkMode represents the networking mode for a container.
const ( NetworkBridge NetworkMode = "bridge" NetworkHost NetworkMode = "host" NetworkNone NetworkMode = "none" NetworkContainer NetworkMode = "container" )
type NetworkSettings ¶
type NetworkSettings struct {
Networks map[string]*EndpointSettings `json:"Networks"`
}
NetworkSettings holds network-related information for a container.
type Port ¶
type Port struct {
IP string `json:"IP,omitempty"`
PrivatePort uint16 `json:"PrivatePort"`
PublicPort uint16 `json:"PublicPort,omitempty"`
Type PortProtocol `json:"Type"`
}
Port represents an open port on a container.
type PortBinding ¶
type PortBinding struct {
HostIP string `json:"HostIp,omitempty"`
HostPort string `json:"HostPort,omitempty"`
}
PortBinding represents a port binding between host and container.
type PortMap ¶
type PortMap map[string][]PortBinding
PortMap is a collection of port bindings keyed by port+proto (e.g. "80/tcp").
type PortProtocol ¶
type PortProtocol string
Port protocol types.
const ( ProtocolTCP PortProtocol = "tcp" ProtocolUDP PortProtocol = "udp" ProtocolSCTP PortProtocol = "sctp" )
type RestartPolicy ¶
type RestartPolicy string
RestartPolicy represents container restart behavior.
const ( RestartNo RestartPolicy = "no" RestartAlways RestartPolicy = "always" RestartUnlessStopped RestartPolicy = "unless-stopped" RestartOnFailure RestartPolicy = "on-failure" )
type RestartPolicyConfig ¶
type RestartPolicyConfig struct {
Name string `json:"Name"`
MaximumRetryCount int `json:"MaximumRetryCount"`
}
RestartPolicyConfig describes container restart behavior.
type SearchResult ¶
type SearchResult struct {
Name string `json:"repo_name"`
Description string `json:"short_description"`
StarCount int `json:"star_count"`
IsOfficial bool `json:"is_official"`
IsAutomated bool `json:"is_automated"`
}
SearchResult is returned from image search.
type SystemEventsResponse ¶
type SystemEventsResponse struct {
Status string `json:"status"`
ID string `json:"id"`
From string `json:"from"`
Type string `json:"Type"`
Action string `json:"Action"`
Actor EventActor `json:"Actor"`
Time int64 `json:"time"`
TimeNano int64 `json:"timeNano"`
}
SystemEventsResponse holds events from the system.
type SystemInfo ¶
type SystemInfo struct {
ID string `json:"ID"`
Name string `json:"Name"`
ServerVersion string `json:"ServerVersion"`
OSType string `json:"OSType"`
OperatingSystem string `json:"OperatingSystem"`
Architecture string `json:"Architecture"`
NCPU int `json:"NCPU"`
MemTotal int64 `json:"MemTotal"`
Driver string `json:"Driver"`
DriverStatus [][2]string `json:"DriverStatus"`
DockerRootDir string `json:"DockerRootDir"`
Images int `json:"Images"`
Containers int `json:"Containers"`
ContainersRunning int `json:"ContainersRunning"`
ContainersPaused int `json:"ContainersPaused"`
ContainersStopped int `json:"ContainersStopped"`
// SecurityOptions lists the isolation features actually enforced by this
// daemon. Populated honestly (C1): features that are currently no-ops (e.g.
// seccomp/apparmor in rootless/proot mode) are NOT reported as active.
SecurityOptions []string `json:"SecurityOptions,omitempty"`
}
SystemInfo holds system-wide information.
type TmpfsOptions ¶
type TmpfsOptions struct {
SizeBytes int64 `json:"SizeBytes,omitempty"`
Mode uint32 `json:"Mode,omitempty"`
}
TmpfsOptions for tmpfs mounts.
type VersionInfo ¶
type VersionInfo struct {
Version string `json:"Version"`
APIVersion string `json:"ApiVersion"`
MinAPIVersion string `json:"MinAPIVersion"`
GitCommit string `json:"GitCommit"`
GoVersion string `json:"GoVersion"`
Os string `json:"Os"`
Arch string `json:"Arch"`
BuildDate string `json:"BuildDate,omitempty"`
BuildUser string `json:"BuildUser,omitempty"`
Experimental bool `json:"Experimental"`
}
VersionInfo holds the structured version payload returned by the /v1.41/version endpoint and emitted on startup logs.
func GetVersion ¶
func GetVersion() *VersionInfo
GetVersion returns the current VersionInfo snapshot.
type VolumeInfo ¶
type VolumeInfo struct {
Name string `json:"Name"`
Driver string `json:"Driver"`
Mountpoint string `json:"Mountpoint"`
Labels map[string]string `json:"Labels"`
Scope string `json:"Scope"`
Options map[string]string `json:"Options"`
CreatedAt time.Time `json:"CreatedAt"`
}
VolumeInfo holds information about a volume.
type VolumeOptions ¶
type VolumeOptions struct {
NoCopy bool `json:"NoCopy,omitempty"`
Labels map[string]string `json:"Labels,omitempty"`
DriverConfig *DriverConfig `json:"DriverConfig,omitempty"`
}
VolumeOptions for volume mounts.