dockerserver

package
v0.0.0-...-8736fb8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2017 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddImage

func AddImage(ref string)

AddImage 添加一个 image 到初始化拉取列表

func Pull

func Pull(client *client.Client)

Pull 拉取所有的初始化 image

Types

type Container

type Container struct {
	*client.Client
	Id string
}

func CreateContainer

func CreateContainer(ctx context.Context, client *client.Client, creator ContainerCreator) (Container, error)

func (Container) Attach

启动并 attach 到 creator 创建的 container

func (Container) Wait

func (c Container) Wait(ctx context.Context) (io.ReadCloser, error)

启动并 等待 creator 创建的 container 退出

func (Container) WriteResultBlock

func (c Container) WriteResultBlock(ctx context.Context, w io.Writer) error

WriteResultBlock 将等待容器退出,一次将所有结果写入 writer

func (Container) WriteResultStream

func (c Container) WriteResultStream(ctx context.Context, w io.Writer) error

WriteResultStream 将结果即时写入 writer

type ContainerCreator

type ContainerCreator interface {
	// 创建 container 并返回 ID
	Create(context.Context, *client.Client) (string, error)
}

ContainerCreator 创建 container

type ResultWriter

type ResultWriter func(Container, context.Context, io.Writer) error

ResultWriter 将 container 的运行结果写入 writer

Jump to

Keyboard shortcuts

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