container_runtime

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2019 License: MIT Imports: 11 Imported by: 0

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

*

  • Detect Docker Toolbox

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) 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) GetName

func (c *Container) GetName() string

GetName gets the container name

func (*Container) GetRunCommand

func (c *Container) GetRunCommand() string

GetRunCommand renders the command needed the run 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) 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