Documentation ¶
Overview ¶
Package libmason provides the base helper for building client-side builder. It consists of an interface (so that you could use the same helper but with a different backend) and implementation and utils function.
Index ¶
- type DefaultHelper
- func (h *DefaultHelper) ContainerAttach(ctx context.Context, container string, stdin io.Reader, ...) error
- func (h *DefaultHelper) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (string, error)
- func (h *DefaultHelper) ContainerCreate(ctx context.Context, createConfig types.ContainerCreateConfig) (types.ContainerCreateResponse, error)
- func (h *DefaultHelper) ContainerKill(ctx context.Context, containerID string) error
- func (h *DefaultHelper) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
- func (h *DefaultHelper) ContainerStart(ctx context.Context, container string) error
- func (h *DefaultHelper) ContainerWait(ctx context.Context, container string, timeout time.Duration) (int, error)
- func (h *DefaultHelper) CopyToContainer(ctx context.Context, container string, destPath, srcPath string, ...) error
- func (h *DefaultHelper) GetImage(ctx context.Context, ref string, options types.ImagePullOptions) (types.ImageInspect, error)
- func (h *DefaultHelper) TagImage(ctx context.Context, image string, newReference string) error
- func (h *DefaultHelper) WithOutputWriter(w io.Writer) *DefaultHelper
- type DockerClient
- type Helper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultHelper ¶
type DefaultHelper struct {
// contains filtered or unexported fields
}
DefaultHelper is a client-side builder base helper implementation.
func NewHelper ¶
func NewHelper(cli DockerClient) *DefaultHelper
NewHelper creates a new Helper from a docker client
func (*DefaultHelper) ContainerAttach ¶
func (h *DefaultHelper) ContainerAttach(ctx context.Context, container string, stdin io.Reader, stdout, stderr io.Writer) error
ContainerAttach attaches to container.
func (*DefaultHelper) ContainerCommit ¶
func (h *DefaultHelper) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (string, error)
ContainerCommit creates a new Docker image from an existing Docker container.
func (*DefaultHelper) ContainerCreate ¶
func (h *DefaultHelper) ContainerCreate(ctx context.Context, createConfig types.ContainerCreateConfig) (types.ContainerCreateResponse, error)
ContainerCreate creates a new Docker container and returns potential warnings FIXME(vdemeester) should validate options ?
func (*DefaultHelper) ContainerKill ¶
func (h *DefaultHelper) ContainerKill(ctx context.Context, containerID string) error
ContainerKill stops the container execution abruptly.
func (*DefaultHelper) ContainerRemove ¶
func (h *DefaultHelper) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error
ContainerRemove removes a container specified by `id`.
func (*DefaultHelper) ContainerStart ¶
func (h *DefaultHelper) ContainerStart(ctx context.Context, container string) error
ContainerStart starts a new container
func (*DefaultHelper) ContainerWait ¶
func (h *DefaultHelper) ContainerWait(ctx context.Context, container string, timeout time.Duration) (int, error)
ContainerWait stops processing until the given container is stopped.
func (*DefaultHelper) CopyToContainer ¶
func (h *DefaultHelper) CopyToContainer(ctx context.Context, container string, destPath, srcPath string, decompress bool) error
CopyToContainer copies/extracts a source FileInfo to a destination path inside a container specified by a container object.
func (*DefaultHelper) GetImage ¶
func (h *DefaultHelper) GetImage(ctx context.Context, ref string, options types.ImagePullOptions) (types.ImageInspect, error)
GetImage looks up a Docker image referenced by `name` and pull it if needed.
func (*DefaultHelper) WithOutputWriter ¶
func (h *DefaultHelper) WithOutputWriter(w io.Writer) *DefaultHelper
WithOutputWriter lets you specify a writer for the small amount of output this package will generate (Pull & such)
type DockerClient ¶
type DockerClient interface { client.ContainerAPIClient client.ImageAPIClient }
DockerClient defines methods a docker client should provide to libmason. It's simply Container & Image methods from docker client.APIClient.
type Helper ¶
type Helper interface { // GetImage looks up a Docker image referenced by `name` and pull it if needed. GetImage(ctx context.Context, name string, options types.ImagePullOptions) (types.ImageInspect, error) // TagImage tags an image with newTag TagImage(ctx context.Context, image string, newReference string) error // ContainerCreate creates a new Docker container and returns potential warnings ContainerCreate(ctx context.Context, config types.ContainerCreateConfig) (types.ContainerCreateResponse, error) // ContainerAttach attaches to container. ContainerAttach(ctx context.Context, container string, stdin io.Reader, stdout, stderr io.Writer) error // ContainerStart starts a new container ContainerStart(ctx context.Context, container string) error // ContainerKill stops the container execution abruptly. ContainerKill(ctx context.Context, container string) error // ContainerRm removes a container specified by `id`. ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error // Commit creates a new Docker image from an existing Docker container. ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (string, error) // ContainerWait stops processing until the given container is stopped. ContainerWait(ctx context.Context, container string, timeout time.Duration) (int, error) // CopyToContainer copies/extracts a source FileInfo to a destination path inside a container // specified by a container object. CopyToContainer(ctx context.Context, container string, destPath, srcPath string, decompress bool) error }
Helper abstracts calls to a Docker Daemon for a client-side builder. It is based on a extraction "revisited" of builder/builder.go from the docker project, and define methods a client-side builder might need.