container_runtime

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 11 Imported by: 1

README

Package: Container Runtime

This package is responsible to communicate with the container runtime and starting / managing them.

Files

File Description
docker.go
docker_container.go
docker_util.go helper methods that are used only internally in docker.go / docker_container.go
util.go helper methods that are used in this module, but not directly part of it

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InArray

func InArray(val interface{}, array interface{}) (exists bool, index int)

*

  • Checks if a object is part of a array

func IsCIEnvironment

func IsCIEnvironment() bool

*

  • Is CI Environment

func IsDockerNative

func IsDockerNative() bool

*

  • Detect Docker native

func IsDockerToolbox

func IsDockerToolbox() bool

IsDockerToolbox returns true, if docker toolbox is used

func IsMinGW added in v0.6.1

func IsMinGW() bool

IsMinGW returns true, if the binary is called from a Minimalist GNU for Windows environment (cygwin / git bash)

func IsPodman added in v0.6.0

func IsPodman() bool

*

  • Detect Podman

Types

type Container

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

Container provides all methods to interact with the container runtime

func (*Container) AddAllEnvironmentVariables

func (c *Container) AddAllEnvironmentVariables()

AddAllEnvironmentVariables adds all environment variables, but filters a few irrelevant ones (like PATH, HOME, etc.)

func (*Container) AddCacheMount

func (c *Container) AddCacheMount(name string, sourcePath string, targetPath string)

AddCacheMount adds a cache mount to the container

func (*Container) AddCapability added in v0.6.0

func (c *Container) AddCapability(capability string)

AddCapability adds a capability to the container

func (*Container) AddContainerPort

func (c *Container) AddContainerPort(port ContainerPort)

AddContainerPort publishes a port

func (*Container) AddContainerPorts

func (c *Container) AddContainerPorts(ports []string)

AddContainerPorts adds multiple published ports

func (*Container) AddEnvironmentVariable

func (c *Container) AddEnvironmentVariable(name string, value string)

AddEnvironmentVariable adds a environment variable

func (*Container) AddEnvironmentVariables

func (c *Container) AddEnvironmentVariables(variables []string)

AddEnvironmentVariables adds multiple environment variables

func (*Container) AddVolume

func (c *Container) AddVolume(mount ContainerMount)

AddVolume mounts a directory into a container

func (*Container) AllowContainerRuntimeAcccess

func (c *Container) AllowContainerRuntimeAcccess()

AllowContainerRuntimeAcccess allows the container to access the container runtime

func (*Container) DetectRuntime added in v0.6.0

func (c *Container) DetectRuntime() string

DetectRuntime returns the first available container runtime

func (*Container) GetDockerCommand added in v0.6.0

func (c *Container) GetDockerCommand() string

GetDockerCommand renders the command needed the run the container using docker (native or toolbox)

func (*Container) GetName

func (c *Container) GetName() string

GetName gets the container name

func (*Container) GetPodmanCommand added in v0.6.0

func (c *Container) GetPodmanCommand() string

GetPodmanCommand renders the command needed the run the container using podman

func (*Container) GetPullCommand added in v0.6.0

func (c *Container) GetPullCommand(runtime string) (string, error)

GetPullCommand gets the command to pull the required image

func (*Container) GetRunCommand

func (c *Container) GetRunCommand(runtime string) string

GetRunCommand gets the run command for the specified container runtime

func (*Container) PullImage added in v0.6.0

func (c *Container) PullImage()

PullImage pulls the image for the container

func (*Container) SetCommand

func (c *Container) SetCommand(newCommand string)

SetCommand sets the container command

func (*Container) SetCommandShell

func (c *Container) SetCommandShell(newCommandShell string)

SetCommandShell sets the command shell

func (*Container) SetEntrypoint

func (c *Container) SetEntrypoint(newEntrypoint string)

SetEntrypoint overwrites the default entrypoint

func (*Container) SetImage

func (c *Container) SetImage(newImage string)

SetImage sets the container image

func (*Container) SetName

func (c *Container) SetName(newName string)

SetName sets a new name for the container

func (*Container) SetUserArgs added in v0.5.1

func (c *Container) SetUserArgs(newArgs string)

SetUserArgs allows the user to pass custom arguments to the container run command, for special cases in ci envs with service links / or similar

func (*Container) SetWorkingDirectory

func (c *Container) SetWorkingDirectory(newWorkingDirectory string)

SetWorkingDirectory sets the working directory

func (*Container) StartContainer

func (c *Container) StartContainer()

StartContainer starts the Container

type ContainerMount

type ContainerMount struct {
	MountType string
	Source    string
	Target    string
}

ContainerMount holds container volume mounts

type ContainerPort

type ContainerPort struct {
	Source int
	Target int
}

ContainerPort holds container ports

type ContainerRuntime

type ContainerRuntime struct{}

ContainerRuntime

func (*ContainerRuntime) NewContainer

func (cr *ContainerRuntime) NewContainer() *Container

NewContainer will get a new container struct to work with

type EnvironmentProperty

type EnvironmentProperty struct {
	Name  string
	Value string
}

EnvironmentProperty holds environment variables

Jump to

Keyboard shortcuts

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