Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrImageNotFound is raised when image is not found
	ErrImageNotFound = errors.New("provision: image not found")

	// ErrContainerNotFound is raised when image is not found
	ErrContainerNotFound = errors.New("provision: container not found")

	// ErrContainerExecutionFailed is raised if container exited with status different of zero
	ErrContainerExecutionFailed = errors.New("provision: container exited with failure")

	// Input receives a string that will be written to the stdin of the container in function FnRun
	Input string
)

Functions

func FnAttach

func FnAttach(client *docker.Client, containerID string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (w docker.CloseWaiter, err error)

    FnAttach attach into a running container

    func FnClient

    func FnClient(endPoint, certsDir string) (client *docker.Client, err error)

      FnClient instantiate a docker client

      func FnContainer

      func FnContainer(client *docker.Client, opts ContainerOptions) (container *docker.Container, err error)

        FnContainer create container

        func FnFindContainer

        func FnFindContainer(client *docker.Client, imageName string) (container docker.APIContainers, err error)

          FnFindContainer return container by image name

          func FnFindContainerByID

          func FnFindContainerByID(client *docker.Client, ID string) (container docker.APIContainers, err error)

            FnFindContainerByID return container by ID

            func FnFindImage

            func FnFindImage(client *docker.Client, imageName string) (image docker.APIImages, err error)

              FnFindImage returns image data by name

              func FnImageBuild

              func FnImageBuild(client *docker.Client, opts *BuildOptions) (Name string, Stdout *bytes.Buffer, err error)

                FnImageBuild builds an image

                func FnKillContainer

                func FnKillContainer(client *docker.Client, containerID string) (err error)

                  FnKillContainer kill the container

                  func FnListContainers

                  func FnListContainers(client *docker.Client) (containers []docker.APIContainers, err error)

                    FnListContainers lists all the containers created by the gofn. It returns the APIContainers from the API, but have to be formatted for pretty printing

                    func FnLogs

                    func FnLogs(client *docker.Client, containerID string, stdout io.Writer, stderr io.Writer) error

                      FnLogs logs all container activity

                      func FnPull

                      func FnPull(client *docker.Client, opts *BuildOptions) (err error)

                        FnPull pull image from registry

                        func FnRemove

                        func FnRemove(client *docker.Client, containerID string) (err error)

                          FnRemove remove container

                          func FnRun

                          func FnRun(client *docker.Client, containerID, input string) (Stdout *bytes.Buffer, Stderr *bytes.Buffer, err error)

                            FnRun runs the container

                            func FnStart

                            func FnStart(client *docker.Client, containerID string) error

                              FnStart start the container

                              func FnWaitContainer

                              func FnWaitContainer(client *docker.Client, containerID string) chan error

                                FnWaitContainer wait until container finnish your processing

                                Types

                                type BuildOptions

                                type BuildOptions struct {
                                	ContextDir              string
                                	Dockerfile              string
                                	DoNotUsePrefixImageName bool
                                	ImageName               string
                                	RemoteURI               string
                                	StdIN                   string
                                	Iaas                    iaas.Iaas
                                	Auth                    docker.AuthConfiguration
                                	ForcePull               bool
                                }

                                  BuildOptions are options used in the image build

                                  func (BuildOptions) GetImageName

                                  func (opts BuildOptions) GetImageName() string

                                    GetImageName sets prefix gofn when needed

                                    type ContainerOptions

                                    type ContainerOptions struct {
                                    	Cmd     []string
                                    	Volumes []string
                                    	Image   string
                                    	Env     []string
                                    	Runtime string
                                    }

                                      ContainerOptions are options used in container