ocispec

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ocispec turns run parameters into the OCI runtime spec that vminitd executes (via vmexec) inside the microVM. It is deliberately VM-independent pure logic — no vsock, no Code-Hex/vz — so it unit-tests as a black box.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidUser = errors.New("invalid user specification")

ErrInvalidUser indicates the process user string is not a supported numeric uid[:gid]. ossein does not resolve names against the guest /etc/passwd.

Functions

func Build

func Build(params Params) (*specs.Spec, error)

Build assembles the OCI runtime spec handed to vminitd. There is no network namespace: the microVM is the network boundary, so the container must see the guest's eth0 directly.

func Command

func Command(entrypoint, cmd, override []string) []string

Command merges the image config with a user override, docker-style: a non-empty override replaces Cmd; Entrypoint is always preserved.

func Marshal

func Marshal(spec *specs.Spec) ([]byte, error)

Marshal serializes the OCI spec for vminitd's Swift decoder. Most of their structs decode leniently (decodeIfPresent), but LinuxNamespace is synthesized Codable and requires the "path" key — which Go's specs-go drops via omitempty when empty. Patch it in post-marshal. The intermediate decode uses UseNumber so large int64s (e.g. RLIM_INFINITY in rlimits) survive the round-trip instead of losing precision as float64.

Types

type Params

type Params struct {
	ContainerID string
	RootfsPath  string
	Args        []string
	Env         []string
	Cwd         string
	User        string // numeric uid[:gid]; empty = root
	TTY         bool
	Privileged  bool
	ExtraMounts []specs.Mount
}

Params describes one container process for Build.

Jump to

Keyboard shortcuts

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