docker

package
v2.1.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package docker is the interface of dunner to communicate with the Docker Engine through methods wrapping over Docker client library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Command string
	Output  string
	Error   string
}

Result stores the output of commands run using `docker exec`

func ExtractResult

func ExtractResult(reader io.Reader, command []string) *Result

ExtractResult can parse output and/or error corresponding to the command passed as an argument, from an io.Reader and convert to an object of strings.

type Step

type Step struct {
	Task      string            // The name of the task that the step corresponds to
	Name      string            // Name given to this step for identification purpose
	Image     string            // Image is the repo name on which Docker containers are built
	Command   []string          // The command which runs on the container and exits
	Commands  [][]string        // The list of commands that are to be run in sequence
	Env       []string          // The list of environment variables to be exported inside the container
	WorkDir   string            // The primary directory on which task is to be run
	Volumes   map[string]string // Volumes that are to be attached to the container
	ExtMounts []mount.Mount     // The directories to be mounted on the container as bind volumes
	Follow    string            // The next task that must be executed if this does go successfully
	Args      []string          // The list of arguments that are to be passed
}

Step describes the information required to run one task in docker container. It is very similar to the concept of docker build of a 'Dockerfile' and then a sequence of commands to be executed in `docker run`.

func (Step) Exec

func (step Step) Exec() (*[]Result, error)

Exec method is used to execute the task described in the corresponding step. It returns an object of the struct `Result` with the corresponding output and/or error.

Note: A working internet connection is mandatory for the Docker container to contact Docker Hub to find the image and/or corresponding updates.

Jump to

Keyboard shortcuts

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