Documentation
¶
Index ¶
- type Container
- func (c *Container) Attach(ctx context.Context) (types.HijackedResponse, error)
- func (c *Container) Commit(ctx context.Context) (string, error)
- func (c *Container) Exec(ctx context.Context, opts *ExecOpts) error
- func (c *Container) Info(ctx context.Context) (*runtime.ContainerInfo, error)
- func (c *Container) Logs(ctx context.Context, since time.Time) (logging.LogReader, error)
- func (c *Container) Name() string
- func (c *Container) Remove(ctx context.Context) error
- func (c *Container) Start(ctx context.Context) error
- func (c *Container) Stats(ctx context.Context) (*runtime.ContainerStats, error)
- func (c *Container) Stop(ctx context.Context, timeout *time.Duration) error
- func (c *Container) Stream(ctx context.Context, resp types.HijackedResponse) error
- type ExecOpts
- type LogReader
- type Runtime
- func (r *Runtime) Close() error
- func (r *Runtime) Container(id string) runtime.Container
- func (r *Runtime) CreateContainer(ctx context.Context, opts *runtime.ContainerOpts) (runtime.Container, error)
- func (r *Runtime) ListContainers(ctx context.Context) ([]runtime.Container, error)
- func (r *Runtime) PullImage(ctx context.Context, image *runtime.DockerImage, policy runtime.PullPolicy, ...) error
- func (r *Runtime) PushImage(ctx context.Context, image *runtime.DockerImage, quiet bool) error
- func (r *Runtime) TagImage(ctx context.Context, source string, target string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container wraps a Docker container in the common runtime interface.
func (*Container) Attach ¶
Attach hijacks the IO streams of a container. This must be called before the container is started.
func (*Container) Commit ¶
Commit the image, saving the contents of the root filesystem as a layer. Returns the SHA of the created image.
func (*Container) Logs ¶
Logs returns logging.LogReader which can be used to read log messages starting at the given time (inclusive). Set time to zero to read the full log.
func (*Container) Stats ¶
Stats scrapes stats information about the container and returns it. This includes information about memory, cpu, network and block IO.
func (*Container) Stop ¶
Stop sends a SIGTERM to a container to instruct it to exit. If a timeout is provided and elapses, the container is forcibly stopped with SIGKILL.
type ExecOpts ¶
type ExecOpts struct { // (required) Command and arguments. Command []string // (optional) Environment variables. Env map[string]string // (optional) User that will run the command. // Defaults to the user of the container's root process. User string // (optional) WorkingDir where the command will be launched. // Defaults to the container's working dir. WorkingDir string }
type LogReader ¶
type LogReader struct {
// contains filtered or unexported fields
}
LogReader translates streamed Docker logs into discrete, structured log messages. This reader is not safe for concurrent use.
func NewLogReader ¶
NewLogReader wraps a streaming Docker log reader. The provided reader must include timestamps.
The reader introduces its own buffering and may read data from r beyond the bytes requested by Read().
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime wraps the Docker runtime in a common interface.
func NewRuntime ¶
NewRuntime creates a new Docker-backed Runtime.
func (*Runtime) CreateContainer ¶
func (r *Runtime) CreateContainer( ctx context.Context, opts *runtime.ContainerOpts, ) (runtime.Container, error)
CreateContainer creates a new container. Call Start to run it.
func (*Runtime) ListContainers ¶
ListContainers enumerates all containers.
func (*Runtime) PullImage ¶
func (r *Runtime) PullImage( ctx context.Context, image *runtime.DockerImage, policy runtime.PullPolicy, quiet bool, ) error
PullImage pulls a Docker image and prints progress to stdout unless quiet is set.