container

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container interface {
	List(ctx context.Context, opts ...func(opt *ListOptions)) ([]entity.Container, error)
	//
	Create(ctx context.Context, opts ...func(opt *CreateOptions)) (co.CreateResponse, error)
	Update(ctx context.Context, id string, opts ...func(opt *UpdateOptions)) (co.ContainerUpdateOKBody, error)
	Remove(ctx context.Context, id string, opts ...func(opt *RemoveOptions)) error
	//
	Start(ctx context.Context, id string, opts ...func(opt *StartOptions)) error
	Stop(ctx context.Context, id string, opts ...func(opt *StopOptions)) error
	Restart(ctx context.Context, id string, opts ...func(opt *RestartOptions)) error
	//
	Inspect(ctx context.Context, id string, opts ...func(opt *InspectOptions)) (*types.ContainerJSON, error)
	//
	Stats(ctx context.Context, id string, opts ...func(opt *StatsOptions)) (*types.ContainerStats, error)
	//
	Logs(ctx context.Context, id string, opts ...func(opt *LogsConfig)) (io.ReadCloser, error)
	//
	Exec(ctx context.Context, id string, opts ...func(opt *ExecOptions)) error
	//
	Run(ctx context.Context, opts ...func(opt *RunOptions)) error
}

Container is the docker container client interface

func New

func New(client *client.Client) Container

New creates a docker container client

type CreateOptions added in v1.2.0

type CreateOptions struct {
	Name string
	//
	Container *co.Config
	Host      *co.HostConfig
	Network   *network.NetworkingConfig
	Platform  *specs.Platform
}

type ExecOptions added in v1.2.0

type ExecOptions struct {
	Detach bool
	Tty    bool
	Cmd    []string
	//
	Stdin  io.Reader
	Stdout io.WriteCloser
	Stderr io.WriteCloser
}

ExecOptions is the options for Exec.

type InspectOptions added in v1.2.0

type InspectOptions struct {
}

type ListOptions added in v1.2.0

type ListOptions = tc.ListOptions

type LogsConfig added in v1.2.0

type LogsConfig struct {
	Follow     bool
	Timestamps bool
	Tail       string
	Since      string
	Until      string
	Details    bool
}

type RemoveOptions added in v1.2.0

type RemoveOptions = tc.RemoveOptions

type RestartOptions added in v1.2.0

type RestartOptions = StopOptions

type RunOptions added in v1.2.0

type RunOptions struct {
	Name string
	//
	Container *co.Config
	Host      *co.HostConfig
	Network   *network.NetworkingConfig
	Platform  *specs.Platform
	//
	Detached bool
	//
	Stdin  io.Reader
	Stdout io.WriteCloser
	Stderr io.WriteCloser
}

RunOptions is the configuration for running a container

type StartOptions added in v1.2.0

type StartOptions = tc.StartOptions

type StatsOptions added in v1.2.0

type StatsOptions struct {
	Stream bool
}

type StopOptions added in v1.2.0

type StopOptions struct {
	// Timeout (optional) is the timeout (in seconds) to wait for the container
	// to stop gracefully before forcibly terminating it with SIGKILL.
	//
	// - Use nil to use the default timeout (10 seconds).
	// - Use '-1' to wait indefinitely.
	// - Use '0' to not wait for the container to exit gracefully, and
	//   immediately proceeds to forcibly terminating the container.
	// - Other positive values are used as timeout (in seconds).
	Timeout int `json:",omitempty"`

	// Signal (optional) is the signal to send to the container to (gracefully)
	// stop it before forcibly terminating the container with SIGKILL after the
	// timeout expires. If not value is set, the default (SIGTERM) is used.
	Signal string `json:"signal,omitempty"`
}

StopOptions holds the options to stop or restart a container.

type UpdateOptions added in v1.2.0

type UpdateOptions struct {
	co.Resources
	RestartPolicy co.RestartPolicy
}

Jump to

Keyboard shortcuts

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