Documentation ¶
Overview ¶
Package docker provides methods for creating and managing docker containers
Index ¶
- type ContainerConfig
- type ContainerFile
- type Controller
- func (c *Controller) ContainerCreate(userConfig *ContainerConfig, volumes []VolumeMount) (containerID string, err error)
- func (c *Controller) ContainerLog(containerID string) (string, error)
- func (c *Controller) ContainerRemove(containerID string) error
- func (c *Controller) ContainerStart(containerID string) error
- func (c *Controller) ContainerWait(containerID string, timeLimit time.Duration) (state int64, err error)
- func (c *Controller) EnsureImage(imageName string) error
- func (c *Controller) EnsureVolume(name string) (new bool, volume *types.Volume, err error)
- func (c *Controller) FindVolume(name string) (volume *types.Volume, err error)
- func (c *Controller) RemoveVolume(name string) error
- func (c *Controller) Run() (statusCode int64, logs string, err error)
- type VolumeMount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerConfig ¶
type ContainerConfig struct { ForBuild bool // Determines if the config is meant to be used Image string // Image which will be used for running code LocalImage bool // Set to true if image shouldn't be pulled from the outside Cmd []string // Defines what will be run when container starts. Use "..." as a name of the file TimeLimit time.Duration // Max time for the container to run MemoryMB int64 // Container memory limit (in megabytes) }
ContainerConfig describes what configuration the container should have
type ContainerFile ¶
type ContainerFile struct { FileName string // Name of file that will contain all the Content Content string // Code that will be executed }
ContainerFile describes what file the container should execute
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is an object that wll be used for running methods off of it
func NewController ¶
func NewController(config *ContainerConfig) (c *Controller, err error)
NewController returns Controller that wll be used for running methods off of it
func (*Controller) ContainerCreate ¶
func (c *Controller) ContainerCreate(userConfig *ContainerConfig, volumes []VolumeMount) (containerID string, err error)
ContainerCreate creates a container
func (*Controller) ContainerLog ¶
func (c *Controller) ContainerLog(containerID string) (string, error)
ContainerLog returns logs of a specific container
func (*Controller) ContainerRemove ¶
func (c *Controller) ContainerRemove(containerID string) error
ContainerRemove removes a container
func (*Controller) ContainerStart ¶
func (c *Controller) ContainerStart(containerID string) error
ContainerStart starts a container
func (*Controller) ContainerWait ¶
func (c *Controller) ContainerWait(containerID string, timeLimit time.Duration) (state int64, err error)
ContainerWait waits until the container is stopped
func (*Controller) EnsureImage ¶
func (c *Controller) EnsureImage(imageName string) error
EnsureImage pulls images from docker hub to make sure in exists
func (*Controller) EnsureVolume ¶
EnsureVolume makes sure specified volume exists and creates it if it doesn't
func (*Controller) FindVolume ¶
func (c *Controller) FindVolume(name string) (volume *types.Volume, err error)
FindVolume finds a specified volume
func (*Controller) RemoveVolume ¶
func (c *Controller) RemoveVolume(name string) error
RemoveVolume removes specified volume
type VolumeMount ¶
VolumeMount is used for specifying volumes for the container to mount