Documentation ¶
Index ¶
- Constants
- type Option
- func Command(cmd ...string) Option
- func Entrypoint(entryPoint string) Option
- func Env(key string, value string) Option
- func EnvFile(envFile string) Option
- func ForcePull(forcePull bool) Option
- func Label(key string, value string) Option
- func RedirectStderr(redirect bool) Option
- func Stderr(w io.Writer) Option
- func StderrCallback(fn func(line string)) Option
- func Stdout(w io.Writer) Option
- func StdoutCallback(fn func(line string)) Option
- func User(user string) Option
- func WorkDir(workDir string) Option
- type Options
- type Service
Constants ¶
View Source
const WorkspaceDir = "/workspace"
WorkspaceDir is the path of the task's mounted workspace inside a container
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
Apply(opts *Options)
}
func Entrypoint ¶
Entrypoint overrides the container image's entrypoint
func RedirectStderr ¶
RedirectStderr redirects stderr to stdout, combining both streams into one.
func StderrCallback ¶
StderrCallback sets the function that gets called for every stderr line
func StdoutCallback ¶
StdoutCallback sets the function that gets called for every stdout line
type Options ¶
type Options struct { // Image is the docker image reference for the container. (Required) Image string // Name sets the name of the container Name string // User sets a different user to run unside the container User string // WorkDir specifies an alternate starting directory WorkDir string // EntryPoint changes the command that is the entrypoint of the docker image EntryPoint string // Command is the list of command arguments to pass to the container Command []string // Env contains additional environment variables to set Env map[string]string // EnvFile loads the given file with the list of environment variables and values EnvFile string // Labels contains a list of labels to apply to the container Labels map[string]string // ForcePull forces a docker pull before running the container, useful if the tag was updated ForcePull bool // Hosts is a list of additional hosts that the container can resolve, like from /etc/hosts // Hosts are given `name:ip` strings like 'foo:10.0.0.3' Hosts []string // StdoutFilePath directs all standard error to a file StdoutFilePath string // RedirectStdError redirects all standard err output into standard out RedirectStdError bool // Stdout directs all standard out to the given writer Stdout io.Writer // Stderr directs all standard err to the given writer Stderr io.Writer // StdoutCallback is an optional function that is called with every output line of the container's standard out StdoutCallback func(string) // StderrCallback is an optional function that is called with every output line of the container's standard err StderrCallback func(string) }
Options are the container run options
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(conn grpc.ClientConnInterface) *Service
func (*Service) RunContainer ¶
RunContainer runs a docker container. The container being run should exit. If the container exits with a non-zero exit code, an error implementing `interface { ExitCode() int }` will be returned from which the exit code may be extracted.
Click to show internal directories.
Click to hide internal directories.