run

package
v1.5.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package runner contains a utility to run Docker containers

Create a RunHelper with NewRunHelper and then create new run instances with New()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunHelper

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

func NewRunHelper

func NewRunHelper(client *docker.Client) *RunHelper

func (*RunHelper) New

func (h *RunHelper) New() *Runner

type Runner

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

Runner is a helper to run new containers on Docker

func (*Runner) Bind

func (h *Runner) Bind(binds ...string) *Runner

Bind tells Docker to bind host dirs to container dirs

func (*Runner) CombinedOutput

func (h *Runner) CombinedOutput() (string, int, error)

CombinedOutput is the same as Output, except both output and error streams are combined into one.

func (*Runner) Command

func (h *Runner) Command(cmd ...string) *Runner

Command sets the command to run

func (*Runner) Create

func (h *Runner) Create() (string, error)

func (*Runner) DiscardContainer

func (h *Runner) DiscardContainer() *Runner

DiscardContainer if true will cause the container to be removed when done executing. Will be ignored in the case of Start

func (*Runner) Entrypoint

func (h *Runner) Entrypoint(cmd ...string) *Runner

Entrypoint sets the entrypoint to use when running

func (*Runner) Env

func (h *Runner) Env(env ...string) *Runner

Env tells Docker to add environment variables to the container getting started

func (*Runner) HostNetwork

func (h *Runner) HostNetwork() *Runner

HostNetwork tells Docker to run using the host's Network namespace

func (*Runner) HostPid

func (h *Runner) HostPid() *Runner

HostPid tells Docker to run using the host's pid namespace

func (*Runner) Image

func (h *Runner) Image(image string) *Runner

Image sets the image to run

func (*Runner) Input

func (h *Runner) Input(reader io.Reader) *Runner

Input sets an input stream for the Docker run command

func (*Runner) Name

func (h *Runner) Name(name string) *Runner

Name sets the name of the container to create

func (*Runner) Output

func (h *Runner) Output() (string, string, int, error)

Output starts the container, waits for it to finish and returns its output

func (*Runner) PortForward

func (h *Runner) PortForward(local, remote int) *Runner

func (*Runner) Privileged

func (h *Runner) Privileged() *Runner

Privileged tells Docker to run the container as privileged

func (*Runner) Run

func (h *Runner) Run() (int, error)

Run executes the container and waits until it completes

func (*Runner) Start

func (h *Runner) Start() (string, error)

Start starts the container as a daemon and returns

Jump to

Keyboard shortcuts

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