config

package
v0.6.6 Latest Latest
Warning

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

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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureImage added in v0.5.0

func EnsureImage(controller *controller.Controller, imageName string) error

EnsureImage pulls an image from the docker hub to make sure in exists

Types

type Builder

type Builder struct {
	Config *Config
	// contains filtered or unexported fields
}

func NewConfigBuilder

func NewConfigBuilder(controller *controller.Controller) *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) 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 maximum amount of memory allocated to the container (in megabytes)

func (*Builder) Mount

func (b *Builder) Mount(mount goboxMount.Mount) *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 maximum allowed time for the container to run

type Config

type Config struct {
	//Fields related to docker API
	ContainerConfig  container.Config
	HostConfig       container.HostConfig
	NetworkingConfig network.NetworkingConfig
	Platform         v1.Platform

	// Maximum allowed time for the container to run
	TimeLimit time.Duration
}

Config contains fields necessary for creating a docker container

Jump to

Keyboard shortcuts

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