docker

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PullNever        = "never"
	PullIfNotPresent = "if-not-present"
	PullAlways       = "always"
)

Variables

View Source
var (
	ErrImageNotAllowed = errors.New("docker sandbox: image not allowed")
	ErrImagePull       = errors.New("docker sandbox: image pull failed")
	ErrCompileFailed   = errors.New("docker sandbox: compile failed")
	ErrRuntimeFailed   = errors.New("docker sandbox: runtime failed")
	ErrTimeout         = errors.New("docker sandbox: timeout")
	ErrCleanup         = errors.New("docker sandbox: cleanup failed")
)

Functions

This section is empty.

Types

type Options

type Options struct {
	Host          string
	AllowedImages []string
}

type RegistryAuth

type RegistryAuth struct {
	ServerAddress string
	Username      string
	Password      string
	IdentityToken string
}

type Result

type Result struct {
	ExitCode        int
	Stdout          []byte
	Stderr          []byte
	StdoutTruncated bool
	StderrTruncated bool
	MemoryUsed      uint64
	CPUUsed         float64
	TimedOut        bool
	ContainerID     string
	Phase           string
}

type Runtime

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

func New

func New(opts Options) (*Runtime, error)

func (*Runtime) Run

func (r *Runtime) Run(ctx context.Context, spec *Spec) (*Result, error)

type Spec

type Spec struct {
	SubmissionID    string
	Language        string
	Image           string
	CompileCmd      []string
	RunCmd          []string
	Env             []string
	Timeout         time.Duration
	CompileTimeout  time.Duration
	RunTimeout      time.Duration
	CPUNano         int64
	MemoryBytes     int64
	PidsLimit       int64
	Ulimits         []Ulimit
	WorkingDir      string
	Stdin           []byte
	NetworkDisabled bool
	ReadonlyRootfs  bool
	User            string
	RegistryAuth    *RegistryAuth
	PullPolicy      string
	WorkspaceDir    string
	CleanupTimeout  time.Duration
	LogLimitBytes   int64
}

type Ulimit

type Ulimit struct {
	Name string
	Soft int64
	Hard int64
}

Jump to

Keyboard shortcuts

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