config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config contains everything necessary to build a config that can be later used to build a docker container from it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Config *Config
}

func NewConfigBuilder

func NewConfigBuilder() *Builder

NewConfigBuilder return new builder that can be used to build config for a container

func (*Builder) Build

func (b *Builder) Build() *Config

Build returns a config that describes a container

func (*Builder) CPUCount

func (b *Builder) CPUCount(CPUCount int) *Builder

CPUCount sets max amount of CPU cycles for the container. Be aware that it might collide with TimeLimit since 1 CPU cycle is approximately 1 second.

func (*Builder) Cmd

func (b *Builder) Cmd(cmd ...string) *Builder

Cmd sets command that will run when container starts

func (*Builder) DiskSpace

func (b *Builder) DiskSpace(diskSpace int) *Builder

DiskSpace sets max disk space allocated for the container (in megabytes) TODO: This might not work. Not yet tested

func (*Builder) Image

func (b *Builder) Image(image string) *Builder

Image sets image that container will use

func (*Builder) MemoryLimit

func (b *Builder) MemoryLimit(memoryLimit int) *Builder

MemoryLimit sets max amount of memory allocated to the container (in megabytes)

func (*Builder) Mount

func (b *Builder) Mount(volume *types.Volume, containerPath string) *Builder

Mount sets a mount point that container will have. Can be called multiple times for multiple mounts

func (*Builder) TimeLimit

func (b *Builder) TimeLimit(timeLimit time.Duration) *Builder

TimeLimit sets max allowed time for the container to run

type Config

type Config struct {
	ContainerConfig  container.Config
	HostConfig       container.HostConfig
	NetworkingConfig network.NetworkingConfig
	Platform         v1.Platform
	TimeLimit        time.Duration
}

Config contains data for creating a docker container

Jump to

Keyboard shortcuts

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