run

package
v3.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2018 License: Apache-2.0 Imports: 11 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(dockerHelper *dockerhelper.Helper) *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) Command

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

Command sets the command to run

func (*Runner) Copy

func (h *Runner) Copy(contents map[string][]byte) *Runner

func (*Runner) Create

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

func (*Runner) DNS

func (h *Runner) DNS(address ...string) *Runner

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

func (*Runner) User

func (h *Runner) User(user string) *Runner

User sets the username or UID to use when running the container. Will be ignored if empty string

Jump to

Keyboard shortcuts

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