docker

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Overview

docker holds useful things for interacting with docker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.0.32

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Client, error)

func (*Client) Connect added in v0.0.32

func (d *Client) Connect(ctx context.Context, cid string) (*Response, error)

Connect returns a response for a container that is already running.

func (*Client) CreateNetwork added in v0.0.32

func (d *Client) CreateNetwork(ctx context.Context, req *NetworkRequest) (*NetworkAttachment, error)

func (*Client) CreateVolume added in v0.0.32

func (d *Client) CreateVolume(ctx context.Context, req *VolumeRequest) (mount.Mount, error)

func (*Client) Remove added in v0.0.32

func (d *Client) Remove(ctx context.Context, resp *Response) error

Remove forcibly removes all the resources associated with the given request.

func (*Client) RemoveNetwork added in v0.0.32

func (d *Client) RemoveNetwork(ctx context.Context, nw *NetworkAttachment) error

func (*Client) RemoveVolume added in v0.0.32

func (d *Client) RemoveVolume(ctx context.Context, v mount.Mount) error

func (*Client) Start added in v0.0.32

func (d *Client) Start(ctx context.Context, req *Request) (*Response, error)

Start starts a container with the given request.

type Content

type Content struct {
	Target string
	Dir    string
	// contains filtered or unexported fields
}

func NewContent

func NewContent(r io.Reader, target string, size int64) *Content

func NewContentFromFile

func NewContentFromFile(f *os.File, target string) (*Content, error)

func NewContentFromString

func NewContentFromString(s string, target string) *Content

func (Content) Read

func (c Content) Read(p []byte) (n int, err error)

Read implements io.Reader.

type NetworkAttachment

type NetworkAttachment struct {
	Name string
	ID   string
}

type NetworkRequest

type NetworkRequest struct {
	// Name is the name of the network to create. If empty, a random name will be
	// generated.
	Name string
	// IPAM is the IP Address Management configuration for the network. Most of
	// the time this can be left empty and set by the daemon.
	IPAM       *network.IPAM
	Labels     map[string]string
	EnableIPv6 bool
}

type Option

type Option func(*Client) error

func WithClient

func WithClient(cli *client.Client) Option

func WithClientOpts

func WithClientOpts(opts ...client.Opt) Option

type Request

type Request struct {
	Ref          name.Reference
	Name         string
	Entrypoint   []string
	User         string // uid:gid
	Env          []string
	Cmd          []string
	Labels       map[string]string
	Privileged   bool
	Resources    ResourcesRequest
	Mounts       []mount.Mount
	Networks     []NetworkAttachment
	Timeout      time.Duration
	HealthCheck  *container.HealthConfig
	Contents     []*Content
	PortBindings nat.PortMap
	ExtraHosts   []string
}

type ResourcesRequest

type ResourcesRequest struct {
	CpuRequest resource.Quantity
	CpuLimit   resource.Quantity

	MemoryRequest resource.Quantity
	MemoryLimit   resource.Quantity
}

type Response

type Response struct {
	types.ContainerJSON
	ID   string
	Name string
	// contains filtered or unexported fields
}

Response is returned from a Start() request.

func (*Response) GetFile added in v0.0.32

func (r *Response) GetFile(ctx context.Context, path string) (io.Reader, error)

func (*Response) Run

func (r *Response) Run(ctx context.Context, cmd harness.Command) error

type VolumeRequest

type VolumeRequest struct {
	// Name is the name of the volume to create, if empty a random name will be
	// generated by the daemon
	Name   string
	Target string
	Labels map[string]string
}

Jump to

Keyboard shortcuts

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