container

package
v0.0.0-...-66e3930 Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: MIT Imports: 43 Imported by: 3

Documentation

Overview

Package container allows for running a process in a container.

Index

Constants

View Source
const (
	// DefaultApparmorProfile is the default apparmor profile for the containers.
	DefaultApparmorProfile = "docker-default"
)
View Source
const (
	// DefaultTarballPath holds the default path for the embedded tarball.
	DefaultTarballPath = "image.tar"
)

Variables

View Source
var DefaultSeccompProfile = &specs.LinuxSeccomp{}

DefaultSeccompProfile defines the whitelist for the default seccomp profile.

Functions

func EmbedImage

func EmbedImage(image string) error

EmbedImage pulls a docker image locally. Creates a tarball of it's contents and then embeds the tarball as binary data into an output bindata.go file.

func Spec

func Spec(opts SpecOpts) *specs.Spec

Spec returns a default oci spec with some options being passed.

Types

type Container

type Container struct {
	ID               string
	Spec             *specs.Spec
	PIDFile          string
	ConsoleSocket    string
	Root             string
	Detach           bool
	UseSystemdCgroup bool
	NoPivotRoot      bool
	NoNewKeyring     bool
	Rootless         bool
}

Container defines the behavior and settings for a container object.

func (*Container) Run

func (c *Container) Run() (int, error)

Run starts the container. It returns the exit status or -1 and an error. Signals sent to the current process will be forwarded to container.

func (*Container) UnpackRootfs

func (c *Container) UnpackRootfs(rootfsDir string, asset func(string) ([]byte, error)) error

UnpackRootfs unpacks the embedded tarball to the rootfs.

type SpecOpts

type SpecOpts struct {
	Rootless bool
	Readonly bool
	Terminal bool
	Args     []string
	Mounts   []specs.Mount
	Hooks    *specs.Hooks
}

SpecOpts defines the options available for a spec.

Jump to

Keyboard shortcuts

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