Documentation ¶
Index ¶
- func Connect(de *Exec, networkName string) error
- func NewTempImage(contextDir, targetStage string, opts ...ImageOption) (string, func() error, error)
- func NewTempNetwork(networkName string) (func() error, error)
- func Supported() error
- type Cmd
- func (cmd *Cmd) CombinedOutput() ([]byte, error)
- func (cmd *Cmd) Output() ([]byte, error)
- func (cmd *Cmd) Run() error
- func (cmd *Cmd) Start() error
- func (cmd *Cmd) StderrPipe() (io.ReadCloser, error)
- func (cmd *Cmd) StdinPipe() (io.WriteCloser, error)
- func (cmd *Cmd) StdoutPipe() (io.ReadCloser, error)
- func (cmd *Cmd) String() string
- func (cmd *Cmd) Wait() error
- type Exec
- type ImageOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTempImage ¶
func NewTempImage(contextDir, targetStage string, opts ...ImageOption) (string, func() error, error)
NewTempImage builds a new image of the specified context and stage then returns the tag and cleaner function.
func NewTempNetwork ¶
NewTempNetwork creates a new network and returns its cleaner function.
Types ¶
type Cmd ¶
type Cmd struct { // Path is the path of the command to run. Path string // Args holds the command line arguents. Args []string // Env holds the environment variables for the command. Env []string // Dir specifies the working direcotroy of the command. Dir string // Stdin specifies the stdin of the command. Stdin io.Reader // Stdout and Stderr specifies the stdout and stderr of the command. Stdout io.Writer Stderr io.Writer // contains filtered or unexported fields }
Cmd is exec.Cmd-like object which provides the way to execute commands in a container.
func (*Cmd) CombinedOutput ¶
CombinedOutput runs the specified commands and returns the combined output of stdout and stderr.
func (*Cmd) StderrPipe ¶
func (cmd *Cmd) StderrPipe() (io.ReadCloser, error)
StderrPipe returns the pipe that will be connected to stderr of the executed command.
func (*Cmd) StdinPipe ¶
func (cmd *Cmd) StdinPipe() (io.WriteCloser, error)
StdinPipe returns the pipe that will be connected to stdin of the executed command.
func (*Cmd) StdoutPipe ¶
func (cmd *Cmd) StdoutPipe() (io.ReadCloser, error)
StdoutPipe returns the pipe that will be connected to stdout of the executed command.
type Exec ¶
type Exec struct { // ContainerName is the name of the target container. ContainerName string }
Exec is an executing environment for a container. Commands can be executed in the container using Command method.
type ImageOption ¶
type ImageOption func(o *imageOptions)
func WithPatchContextDir ¶
func WithPatchContextDir(patchContextDir string) ImageOption
WithPatchContextDir is a context dir of a build which will be executed based on the Dockerfile specified by the arguments of NewTempImage. When this option is used, WithPatchDockerfile corresponding to this context dir must be specified as well.
func WithPatchDockerfile ¶
func WithPatchDockerfile(patchDockerfile string) ImageOption
WithPatchDockerfile is a part of Dockerfile that will be built based on the Dockerfile specified by the arguments of NewTempImage.
func WithTempImageBuildArgs ¶
func WithTempImageBuildArgs(buildArgs ...string) ImageOption
WithTempImageBuildArgs specifies the build args that will be used during build.
func WithTempImageStdio ¶
func WithTempImageStdio(stdout, stderr io.Writer) ImageOption
WithTempImageStdio specifies stdio which docker build command's stdio will be streamed into.