docker

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRestartPolicyModeFromString added in v0.1.1

func MustRestartPolicyModeFromString(pol string) dcontainer.RestartPolicyMode

func RestartPolicyModeFromString

func RestartPolicyModeFromString(pol string) (dcontainer.RestartPolicyMode, error)

func RestartPolicyModeValidValues

func RestartPolicyModeValidValues() string

func WithAPIClient

func WithAPIClient(ctx context.Context, client APIClient) context.Context

func WithContainerPurgeKillAttempts added in v0.1.1

func WithContainerPurgeKillAttempts(ctx context.Context, attempts uint32) context.Context

Types

type APIClient

type APIClient interface {
	Close() error

	ContainerCreate(ctx context.Context, config *dcontainer.Config, hostConfig *dcontainer.HostConfig, networkingConfig *dnetwork.NetworkingConfig, platform *ocispec.Platform, containerName string) (dcontainer.CreateResponse, error)
	ContainerInspect(ctx context.Context, containerName string) (dtypes.ContainerJSON, error)
	ContainerKill(ctx context.Context, containerName, signal string) error
	ContainerRemove(ctx context.Context, containerName string, options dcontainer.RemoveOptions) error
	ContainerStart(ctx context.Context, containerName string, options dcontainer.StartOptions) error
	ContainerStop(ctx context.Context, containerName string, options dcontainer.StopOptions) error

	ImageList(ctx context.Context, options dimage.ListOptions) ([]dimage.Summary, error)
	ImagePull(ctx context.Context, refStr string, options dimage.PullOptions) (io.ReadCloser, error)

	NetworkConnect(ctx context.Context, networkName, containerName string, config *dnetwork.EndpointSettings) error
	NetworkCreate(ctx context.Context, networkName string, options dnetwork.CreateOptions) (dnetwork.CreateResponse, error)
	NetworkDisconnect(ctx context.Context, networkName, containerName string, force bool) error
	NetworkList(ctx context.Context, options dnetwork.ListOptions) ([]dnetwork.Summary, error)
	NetworkRemove(ctx context.Context, networkName string) error
}

func APIClientFromContext

func APIClientFromContext(ctx context.Context) (APIClient, bool)

func MustAPIClient

func MustAPIClient(ctx context.Context) APIClient

func MustRealAPIClient

func MustRealAPIClient(ctx context.Context) APIClient

type Client

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

func NewClient

func NewClient(ctx context.Context) *Client

func (*Client) Close

func (d *Client) Close()

func (*Client) ConnectContainerToBridgeModeNetwork

func (d *Client) ConnectContainerToBridgeModeNetwork(ctx context.Context, containerName, networkName, ip string) error

func (*Client) ContainerPurgeKillAttempts added in v0.1.1

func (d *Client) ContainerPurgeKillAttempts() uint32

func (*Client) CreateContainer

func (d *Client) CreateContainer(ctx context.Context, containerName string, cConfig *dcontainer.Config, hConfig *dcontainer.HostConfig, nConfig *dnetwork.NetworkingConfig) error

func (*Client) CreateNetwork

func (d *Client) CreateNetwork(ctx context.Context, networkName string, options dnetwork.CreateOptions) error

func (*Client) DisconnectContainerFromNetwork

func (d *Client) DisconnectContainerFromNetwork(ctx context.Context, containerName, networkName string) error

func (*Client) GetContainerState

func (d *Client) GetContainerState(ctx context.Context, containerName string) (ContainerState, error)

func (*Client) KillContainer

func (d *Client) KillContainer(ctx context.Context, containerName string) error

func (*Client) NetworkExists

func (d *Client) NetworkExists(ctx context.Context, networkName string) bool

func (*Client) PullImage

func (d *Client) PullImage(ctx context.Context, imageName string) error

func (*Client) QueryLocalImage

func (d *Client) QueryLocalImage(ctx context.Context, imageName string) (bool, string)

func (*Client) RemoveContainer

func (d *Client) RemoveContainer(ctx context.Context, containerName string) error

func (*Client) RemoveNetwork

func (d *Client) RemoveNetwork(ctx context.Context, networkName string) error

func (*Client) StartContainer

func (d *Client) StartContainer(ctx context.Context, containerName string) error

func (*Client) StopContainer

func (d *Client) StopContainer(ctx context.Context, containerName string) error

type ContainerState

type ContainerState uint8
const (
	ContainerStateUnknown ContainerState = iota
	ContainerStateNotFound
	ContainerStateCreated
	ContainerStateRunning
	ContainerStatePaused
	ContainerStateRestarting
	ContainerStateRemoving
	ContainerStateExited
	ContainerStateDead
)

func (ContainerState) String

func (c ContainerState) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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