udocker

package
v0.0.0-...-f6c12a3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

μDocker - super-lightweight Docker client. pulling in the official client uses huge amounts of code and memory

Index

Constants

View Source
const (
	ListContainersEndpoint = "/v1.24/containers/json"
	TasksEndpoint          = "/v1.24/tasks?filters=%7B%22desired-state%22%3A%5B%22running%22%5D%7D"
	ServicesEndpoint       = "/v1.24/services"
	NodesEndpoint          = "/v1.24/nodes"
)
View Source
const (
	SwarmServiceNameLabelKey = "com.docker.swarm.service.name"
)

Variables

This section is empty.

Functions

func Client

func Client(
	dockerUrl string,
	clientCertificateLoader certificateLoader,
	insecureSkipVerify bool,
) (*http.Client, string, error)

func ClientCertificateFromEnv

func ClientCertificateFromEnv() (*tls.Certificate, error)

func ContainerInspectEndpoint

func ContainerInspectEndpoint(containerId string) string

func DefaultDockerSockClient

func DefaultDockerSockClient() (*http.Client, string, error)

func NetworkInspectEndpoint

func NetworkInspectEndpoint(networkId string) string

Types

type Container

type Container struct {
	Id     string          `json:"Id"`
	Name   string          `json:"Name"`
	Image  string          `json:"Image"`
	Config ContainerConfig `json:"Config"`
	Mounts []Mount         `json:"Mounts"`
}

type ContainerConfig

type ContainerConfig struct {
	Labels     map[string]string `json:"Labels"`
	Env        []string          `json:"Env"`
	Entrypoint []string          `json:"Entrypoint"`
}

type ContainerHealth

type ContainerHealth struct {
	Status        string // "none" | "starting" | "healthy" | "unhealthy"
	FailingStreak int
	Log           []struct {
		Start    time.Time
		End      time.Time
		ExitCode int
		Output   string
	}
}

type ContainerListItem

type ContainerListItem struct {
	Id              string            `json:"Id"`
	Names           []string          `json:"Names"`
	Image           string            `json:"Image"`
	Labels          map[string]string `json:"Labels"`
	State           ContainerState    `json:"State"`
	NetworkSettings struct {
		Networks map[string]struct {
			IPAddress string `json:"IPAddress"`
		} `json:"Networks"`
	} `json:"NetworkSettings"`
}

stupid Docker requires "inspect" to get actually interesting details

type ContainerState

type ContainerState struct {
	Status string           `json:"Status"` // "created" | "running" | "paused" | "restarting" | "removing" | "exited" | "dead"
	Health *ContainerHealth `json:"Health,omitempty"`
}

type Mount

type Mount struct {
	Type   string `json:"Type"`
	Name   string `json:"Name"`
	Source string `json:"Source"`
	Driver string `json:"Driver"`
}

type NetworkInspectOutput

type NetworkInspectOutput struct {
	Containers map[string]*struct {
		IPv4Address string `json:"IPv4Address"` // looks like 10.0.1.7/24
	} `json:"Containers"`
}

type Node

type Node struct {
	ID          string          `json:"ID"`
	Description NodeDescription `json:"Description"`
	Status      struct {
		Addr string `json:"Addr"`
	} `json:"Status"`
}

type NodeDescription

type NodeDescription struct {
	Hostname string `json:"Hostname"`
}

type Service

type Service struct {
	ID   string      `json:"ID"`
	Spec ServiceSpec `json:"Spec"`
}

type ServiceSpec

type ServiceSpec struct {
	Name         string                  `json:"Name"`
	TaskTemplate ServiceSpecTaskTemplate `json:"TaskTemplate"`
	Labels       map[string]string       `json:"Labels"`
}

type ServiceSpecTaskTemplate

type ServiceSpecTaskTemplate struct {
	ContainerSpec ServiceSpecTaskTemplateContainerSpec `json:"ContainerSpec"`
}

type ServiceSpecTaskTemplateContainerSpec

type ServiceSpecTaskTemplateContainerSpec struct {
	Image string   `json:"Image"`
	Env   []string `json:"Env"`
}

type Task

type Task struct {
	ID                  string                  `json:"ID"`
	ServiceID           string                  `json:"ServiceID"`
	NodeID              string                  `json:"NodeID"`
	NetworksAttachments []TaskNetworkAttachment `json:"NetworksAttachments"`
}

type TaskNetworkAttachment

type TaskNetworkAttachment struct {
	Network   TaskNetworkAttachmentNetwork `json:"Network"`
	Addresses []string                     `json:"Addresses"`
}

type TaskNetworkAttachmentNetwork

type TaskNetworkAttachmentNetwork struct {
	ID   string                           `json:"ID"`
	Spec TaskNetworkAttachmentNetworkSpec `json:"Spec"`
}

type TaskNetworkAttachmentNetworkSpec

type TaskNetworkAttachmentNetworkSpec struct {
	Name string `json:"Name"`
}

Jump to

Keyboard shortcuts

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