moby

package
v0.0.0-...-33ee279 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// PaxRecordLinuxkitSource report the package source for a specific file
	PaxRecordLinuxkitSource = "LINUXKIT.source"
	// PaxRecordLinuxkitLocation report the location of the file in the linuxkit.yaml
	// that led to this file being in this location
	PaxRecordLinuxkitLocation = "LINUXKIT.location"
)

Variables

This section is empty.

Functions

func IDNumeric

func IDNumeric(v interface{}, idMap map[string]uint32) (uint32, error)

func NewAPKTarWriter

func NewAPKTarWriter(w *tar.Writer, location string) *apkTarWriter

func UpdateImages

func UpdateImages(m *Moby)

Types

type Device

type Device struct {
	Path  string `yaml:"path" json:"path"`
	Type  string `yaml:"type" json:"type"`
	Major int64  `yaml:"major" json:"major"`
	Minor int64  `yaml:"minor" json:"minor"`
	Mode  string `yaml:"mode,omitempty" json:"mode,omitempty"`
}

Device specifies a device to be exposed to the container.

type File

type File struct {
	Path      string      `yaml:"path" json:"path"`
	Directory bool        `yaml:"directory" json:"directory"`
	Symlink   string      `yaml:"symlink,omitempty" json:"symlink,omitempty"`
	Contents  *string     `yaml:"contents,omitempty" json:"contents,omitempty"`
	Source    string      `yaml:"source,omitempty" json:"source,omitempty"`
	Metadata  string      `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	Optional  bool        `yaml:"optional" json:"optional"`
	Mode      string      `yaml:"mode,omitempty" json:"mode,omitempty"`
	UID       interface{} `yaml:"uid,omitempty" json:"uid,omitempty"`
	GID       interface{} `yaml:"gid,omitempty" json:"gid,omitempty"`
}

File is the type of a file specification

type Image

type Image struct {
	Name        string `yaml:"name" json:"name"`
	Image       string `yaml:"image" json:"image"`
	ImageConfig `yaml:",inline"`
}

Image is the type of an image config

func NewImage

func NewImage(config []byte) (Image, error)

NewImage validates an parses yaml or json for a Image

func (*Image) Equal

func (i *Image) Equal(o *Image) bool

Equal check if another Image is functionally equal to this one. Takes the easy path by marshaling both into yaml and then comparing the yaml. There may be a more efficient way to do this, but this is simplest.

type ImageConfig

type ImageConfig struct {
	Capabilities      *[]string               `yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
	CapabilitiesAdd   *[]string               `yaml:"capabilities.add,omitempty" json:"capabilities.add,omitempty"`
	Ambient           *[]string               `yaml:"ambient,omitempty" json:"ambient,omitempty"`
	Mounts            *[]specs.Mount          `yaml:"mounts,omitempty" json:"mounts,omitempty"`
	Binds             *[]string               `yaml:"binds,omitempty" json:"binds,omitempty"`
	BindsAdd          *[]string               `yaml:"binds.add,omitempty" json:"binds.add,omitempty"`
	Devices           *[]Device               `yaml:"devices,omitempty" json:"devices,omitempty"`
	Tmpfs             *[]string               `yaml:"tmpfs,omitempty" json:"tmpfs,omitempty"`
	Command           *[]string               `yaml:"command,omitempty" json:"command,omitempty"`
	Env               *[]string               `yaml:"env,omitempty" json:"env,omitempty"`
	Cwd               string                  `yaml:"cwd,omitempty" json:"cwd,omitempty"`
	Net               string                  `yaml:"net,omitempty" json:"net,omitempty"`
	Pid               string                  `yaml:"pid,omitempty" json:"pid,omitempty"`
	Ipc               string                  `yaml:"ipc,omitempty" json:"ipc,omitempty"`
	Uts               string                  `yaml:"uts,omitempty" json:"uts,omitempty"`
	Userns            string                  `yaml:"userns,omitempty" json:"userns,omitempty"`
	Hostname          string                  `yaml:"hostname,omitempty" json:"hostname,omitempty"`
	Readonly          *bool                   `yaml:"readonly,omitempty" json:"readonly,omitempty"`
	MaskedPaths       *[]string               `yaml:"maskedPaths,omitempty" json:"maskedPaths,omitempty"`
	ReadonlyPaths     *[]string               `yaml:"readonlyPaths,omitempty" json:"readonlyPaths,omitempty"`
	UID               *interface{}            `yaml:"uid,omitempty" json:"uid,omitempty"`
	GID               *interface{}            `yaml:"gid,omitempty" json:"gid,omitempty"`
	AdditionalGids    *[]interface{}          `yaml:"additionalGids,omitempty" json:"additionalGids,omitempty"`
	NoNewPrivileges   *bool                   `yaml:"noNewPrivileges,omitempty" json:"noNewPrivileges,omitempty"`
	OOMScoreAdj       *int                    `yaml:"oomScoreAdj,omitempty" json:"oomScoreAdj,omitempty"`
	RootfsPropagation *string                 `yaml:"rootfsPropagation,omitempty" json:"rootfsPropagation,omitempty"`
	CgroupsPath       *string                 `yaml:"cgroupsPath,omitempty" json:"cgroupsPath,omitempty"`
	Resources         *specs.LinuxResources   `yaml:"resources,omitempty" json:"resources,omitempty"`
	Sysctl            *map[string]string      `yaml:"sysctl,omitempty" json:"sysctl,omitempty"`
	Rlimits           *[]string               `yaml:"rlimits,omitempty" json:"rlimits,omitempty"`
	UIDMappings       *[]specs.LinuxIDMapping `yaml:"uidMappings,omitempty" json:"uidMappings,omitempty"`
	GIDMappings       *[]specs.LinuxIDMapping `yaml:"gidMappings,omitempty" json:"gidMappings,omitempty"`
	Annotations       *map[string]string      `yaml:"annotations,omitempty" json:"annotations,omitempty"`

	Runtime *Runtime `yaml:"runtime,omitempty" json:"runtime,omitempty"`
	// contains filtered or unexported fields
}

ImageConfig is the configuration part of Image, it is the subset which is valid in a "org.mobyproject.config" label on an image. Everything except Runtime and ref is used to build the OCI spec

func (ImageConfig) Ref

func (i ImageConfig) Ref() *reference.Spec

type Interface

type Interface struct {
	Name         string `yaml:"name,omitempty" json:"name,omitempty"`
	Add          string `yaml:"add,omitempty" json:"add,omitempty"`
	Peer         string `yaml:"peer,omitempty" json:"peer,omitempty"`
	CreateInRoot bool   `yaml:"createInRoot" json:"createInRoot"`
}

Interface is the runtime config for network interfaces

type KernelConfig

type KernelConfig struct {
	Image   string  `yaml:"image" json:"image"`
	Cmdline string  `yaml:"cmdline,omitempty" json:"cmdline,omitempty"`
	Binary  string  `yaml:"binary,omitempty" json:"binary,omitempty"`
	Tar     *string `yaml:"tar,omitempty" json:"tar,omitempty"`
	UCode   *string `yaml:"ucode,omitempty" json:"ucode,omitempty"`
	// contains filtered or unexported fields
}

KernelConfig is the type of the config for a kernel

func (KernelConfig) Ref

func (k KernelConfig) Ref() *reference.Spec

type Moby

type Moby struct {
	Kernel     KernelConfig `kernel:"cmdline,omitempty" json:"kernel,omitempty"`
	Init       []string     `init:"cmdline" json:"init"`
	Onboot     []*Image     `yaml:"onboot" json:"onboot"`
	Onshutdown []*Image     `yaml:"onshutdown" json:"onshutdown"`
	Services   []*Image     `yaml:"services" json:"services"`
	Files      []File       `yaml:"files" json:"files"`
	Volumes    []*Volume    `yaml:"volumes" json:"volumes"`
	// contains filtered or unexported fields
}

Moby is the type of a Moby config file

func AppendConfig

func AppendConfig(m0, m1 Moby) (Moby, error)

AppendConfig appends two configs.

func NewConfig

func NewConfig(config []byte, packageFinder spec.PackageResolver) (Moby, error)

NewConfig parses a config file

func (Moby) InitRefs

func (m Moby) InitRefs() []*reference.Spec

func (Moby) VolByName

func (m Moby) VolByName(name string) *Volume

type Namespaces

type Namespaces struct {
	Cgroup *string `yaml:"cgroup,omitempty" json:"cgroup,omitempty"`
	Ipc    *string `yaml:"ipc,omitempty" json:"ipc,omitempty"`
	Mnt    *string `yaml:"mnt,omitempty" json:"mnt,omitempty"`
	Net    *string `yaml:"net,omitempty" json:"net,omitempty"`
	Pid    *string `yaml:"pid,omitempty" json:"pid,omitempty"`
	User   *string `yaml:"user,omitempty" json:"user,omitempty"`
	Uts    *string `yaml:"uts,omitempty" json:"uts,omitempty"`
}

Namespaces is the type for configuring paths to bind namespaces

type Runtime

type Runtime struct {
	Cgroups    *[]string      `yaml:"cgroups,omitempty" json:"cgroups,omitempty"`
	Mounts     *[]specs.Mount `yaml:"mounts,omitempty" json:"mounts,omitempty"`
	Mkdir      *[]string      `yaml:"mkdir,omitempty" json:"mkdir,omitempty"`
	Interfaces *[]Interface   `yaml:"interfaces,omitempty,omitempty" json:"interfaces,omitempty"`
	BindNS     Namespaces     `yaml:"bindNS,omitempty" json:"bindNS,omitempty"`
	Namespace  *string        `yaml:"namespace,omitempty" json:"namespace,omitempty"`
}

Runtime is the type of config processed at runtime, not used to build the OCI spec

func ConfigToOCI

func ConfigToOCI(yaml *Image, config imagespec.ImageConfig, idMap map[string]uint32) (specs.Spec, Runtime, error)

ConfigToOCI converts a config and the output of image inspect to an OCI config

type Volume

type Volume struct {
	Name      string   `yaml:"name" json:"name"`
	Image     string   `yaml:"image,omitempty" json:"image,omitempty"`
	ReadOnly  bool     `yaml:"readonly,omitempty" json:"readonly,omitempty"`
	Format    string   `yaml:"format,omitempty" json:"format,omitempty"`
	Platforms []string `yaml:"platforms,omitempty" json:"platforms,omitempty"`
	// contains filtered or unexported fields
}

Volume is the type of a volume specification

func (Volume) BaseDir

func (v Volume) BaseDir() string

func (Volume) ImageRef

func (v Volume) ImageRef() *reference.Spec

func (Volume) LowerDir

func (v Volume) LowerDir() string

func (Volume) MergedDir

func (v Volume) MergedDir() string

func (Volume) TmpDir

func (v Volume) TmpDir() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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