crt

package
v0.0.0-...-f12bd69 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AutoRuntime     = "auto" //auto-select by detecting runtimes
	AutoRuntimeDesc = "Auto-select based on detected runtimes"

	DockerRuntime     = "docker"
	DockerRuntimeDesc = "Docker runtime - debug a container running in Docker"

	ContainerdRuntime     = "containerd"
	ContainerdRuntimeDesc = "ContainerD runtime"

	KubernetesRuntime     = "k8s"
	KubernetesRuntimeDesc = "Kubernetes runtime - debug a container running in Kubernetes"

	KubeconfigDefault = "${HOME}/.kube/config"
	NamespaceDefault  = "default"

	PodmanRuntime     = "podman"
	PodmanRuntimeDesc = "Podman runtime"
)
View Source
const (
	ContainerdRuntimeSocket = "/var/run/containerd/containerd.sock"
	DockerRuntimeSocket     = "/var/run/docker.sock"
	PodmanRuntimeSocket     = "/var/run/podman/podman.sock"
)

Variables

View Source
var (
	ErrBadParam = errors.New("crt - bad parameter")
	ErrNotFound = errors.New("crt - not found")
)
View Source
var PodmanConnErr error

Functions

func AutoSelectRuntime

func AutoSelectRuntime() string

func AvailableRuntimes

func AvailableRuntimes() []string

func CanConnect

func CanConnect(socket string) bool

func ExtractRegistry

func ExtractRegistry(repo string) string

func GetPodmanConnContext

func GetPodmanConnContext() context.Context

func GetPodmanConnContextWithConn

func GetPodmanConnContextWithConn(connURI string) context.Context

func GetPodmanRemotePath

func GetPodmanRemotePath() string

func GetPodmanSocketPath

func GetPodmanSocketPath() string

func HasSocket

func HasSocket(name string) bool

func PodmanGetDefaultConnection

func PodmanGetDefaultConnection() (string, string)

func PodmanIsRemote

func PodmanIsRemote() bool

Types

type AuthConfig

type AuthConfig interface{}

type BasicImageInfo

type BasicImageInfo struct {
	ID      string
	Size    int64
	Created int64
	//VirtualSize int64 <- Docker depricated its VirtualSize field in v1.44
	//empty for filtered calls
	ParentID    string
	RepoTags    []string
	RepoDigests []string
	Labels      map[string]string
}

type HealthConfig

type HealthConfig struct {
	Test          []string      `json:",omitempty"`
	Interval      time.Duration `json:",omitempty"`
	Timeout       time.Duration `json:",omitempty"`
	StartPeriod   time.Duration `json:",omitempty"`
	StartInterval time.Duration `json:",omitempty"`
	Retries       int           `json:",omitempty"`
}

type ImageBuilderAPIClient

type ImageBuilderAPIClient interface {
	BuildImage(options imagebuilder.DockerfileBuildOptions) error
	BuildOutputLog() string
}

type ImageHistory

type ImageHistory struct {
	ID        string `json:"Id"`
	Created   int64
	CreatedBy string
	Tags      []string
	Size      int64
	Comment   string
}

type ImageIdentity

type ImageIdentity struct {
	ID           string
	ShortTags    []string
	RepoTags     []string
	ShortDigests []string
	RepoDigests  []string
}

func ImageToIdentity

func ImageToIdentity(info *ImageInfo) *ImageIdentity

type ImageInfo

type ImageInfo struct {
	Created      time.Time
	ID           string
	RepoTags     []string
	RepoDigests  []string
	Size         int64
	VirtualSize  int64
	OS           string
	Architecture string
	Author       string
	Config       *RunConfig

	RuntimeVersion string //instead of DockerVersion
	RuntimeName    string //instead of DockerVersion
}

type ImageLoaderAPIClient

type ImageLoaderAPIClient interface {
	LoadImage(localPath string, outputStream io.Writer) error
}

type ImageSaverAPIClient

type ImageSaverAPIClient interface {
	SaveImage(imageRef, localPath string, extract, removeOrig bool, inactivityTimeout int) error
}

type InspectorAPIClient

type InspectorAPIClient interface {
	HasImage(imageRef string) (*ImageIdentity, error)
	ListImages(imageNameFilter string) (map[string]BasicImageInfo, error)
	ListImagesAll() ([]BasicImageInfo, error)
	InspectImage(imageRef string) (*ImageInfo, error)
	GetImagesHistory(imageRef string) ([]ImageHistory, error)

	PullImage(opts PullImageOptions, authConfig AuthConfig) error
	GetRegistryAuthConfig(account, secret, configPath, registry string) (AuthConfig, error)
}

type PullImageOptions

type PullImageOptions struct {
	Repository   string
	Tag          string
	OutputStream io.Writer
}

type RunConfig

type RunConfig struct {
	User         string              `json:"User,omitempty"`
	ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"`
	Env          []string            `json:"Env,omitempty"`
	Entrypoint   []string            `json:"Entrypoint,omitempty"`
	Cmd          []string            `json:"Cmd,omitempty"`
	Volumes      map[string]struct{} `json:"Volumes,omitempty"`
	WorkingDir   string              `json:"WorkingDir,omitempty"`
	Labels       map[string]string   `json:"Labels,omitempty"`
	StopSignal   string              `json:"StopSignal,omitempty"`
	ArgsEscaped  bool                `json:"ArgsEscaped,omitempty"`
	Healthcheck  *HealthConfig       `json:"Healthcheck,omitempty"`
	//Extra fields
	AttachStderr    bool     `json:"AttachStderr,omitempty"`
	AttachStdin     bool     `json:"AttachStdin,omitempty"`
	AttachStdout    bool     `json:"AttachStdout,omitempty"`
	Domainname      string   `json:"Domainname,omitempty"`
	Hostname        string   `json:"Hostname,omitempty"`
	Image           string   `json:"Image,omitempty"`
	OnBuild         []string `json:"OnBuild,omitempty"`
	OpenStdin       bool     `json:"OpenStdin,omitempty"`
	StdinOnce       bool     `json:"StdinOnce,omitempty"`
	Tty             bool     `json:"Tty,omitempty"`
	NetworkDisabled bool     `json:"NetworkDisabled,omitempty"`
	MacAddress      string   `json:"MacAddress,omitempty"`
	StopTimeout     *int     `json:"StopTimeout,omitempty"`
	Shell           []string `json:"Shell,omitempty"`
}

RunConfig describes the runtime config parameters for container instances (aka Config in other libraries) Fields (ordered according to spec): Memory, MemorySwap, CpuShares aren't necessary * https://github.com/opencontainers/image-spec/blob/main/config.md#properties (Config field) * https://github.com/moby/moby/blob/master/api/types/container/config.go#L70 Note: related to pkg/docker/dockerimage/ContainerConfig TODO: refactor into one set of common structs later

type RuntimeInfo

type RuntimeInfo struct {
	Name        string
	Description string
	Socket      string
}

Directories

Path Synopsis
docker
podman

Jump to

Keyboard shortcuts

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