containerd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCrictl

func ExecCrictl(socketPath string, args []string) error

ExecCrictl runs the crictl CLI in-process against ephemerd's embedded containerd. The CRI plugin is registered by the containerd builtins blank import (see server.go) and served on the same socket as the native API.

This function sets CONTAINER_RUNTIME_ENDPOINT / IMAGE_SERVICE_ENDPOINT to the CRI URI for socketPath, then invokes crictl's urfave/cli v2 app via the k3s-io/cri-tools fork's exported Main() entry point (upstream cri-tools is package main; the fork patches it to package crictl so we can call it as a library). The replace directive is in go.mod.

crictl.Main() may call logrus.Fatal (which os.Exit's) on unrecoverable errors. That's acceptable because the caller is a leaf "ephemerd crictl" subcommand whose process is meant to exit anyway.

func ExecCtr

func ExecCtr(socketPath string, args []string) error

ExecCtr runs the ctr CLI against ephemerd's containerd instance. This provides the "ephemerd ctrctl" debugging interface.

func SocketPath

func SocketPath(dataDir string) string

SocketPath returns the containerd socket path for the given data directory.

Types

type Config

type Config struct {
	DataDir string
	// SocketPath optionally overrides the gRPC listener path. Empty falls
	// back to the platform default (\\.\pipe\ephemerd-containerd on Windows,
	// <DataDir>/containerd/containerd.sock on Unix). Used by tests so
	// multiple containerd instances can co-exist with the running daemon.
	SocketPath string
	TCPPort    uint32 // optional: also listen on TCP for remote access (e.g. from WSL host)
	TCPAddr    string // optional bind address for TCP listener (default "127.0.0.1")
	Log        *slog.Logger
}

Config for the embedded containerd instance.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server manages the in-process containerd lifecycle.

func New

func New(cfg Config) (*Server, error)

New creates and starts an embedded containerd server in-process.

containerd runs as a Go library in a goroutine, following the k3s/rke2 model. No external containerd binary is needed.

func (*Server) Client

func (s *Server) Client() *client.Client

Client returns the containerd client connected to the embedded instance.

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down the embedded containerd server.

Jump to

Keyboard shortcuts

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