Documentation ¶
Index ¶
- type APIClient
- type Client
- func (d *Client) ContainerExec(containerName string, rootUser bool, command []string) (ExecResult, error)
- func (d *Client) ContainerGetMounts(containerName string) []types.MountPoint
- func (d *Client) ContainerList(site string) ([]types.Container, error)
- func (d *Client) ContainerRestart(containerName string) (bool, error)
- func (d *Client) ContainerRun(config *ContainerConfig, randomPorts, localUser bool) (id string, err error)
- func (d *Client) ContainerRunAndClean(config *ContainerConfig) (statusCode int64, body string, err error)
- func (d *Client) ContainerStop(containerName string) (bool, error)
- func (d *Client) EnsureImage(imageName string, updateDays int, consoleOutput *console.Console) (err error)
- func (d *Client) EnsureNetwork(name string) (created bool, network types.NetworkResource, err error)
- func (d *Client) RemoveNetwork(name string) (removed bool, err error)
- type ContainerAPIClient
- type ContainerConfig
- type Context
- type ExecResult
- type ExposedPorts
- type ImageAPIClient
- type NetworkAPIClient
- type ViperClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient interface { ContainerAPIClient ImageAPIClient NetworkAPIClient }
APIClient is an interface that clients that talk with a docker server must implement.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an interface the must be implemented to provide Docker services through this package.
func NewDockerClient ¶
func (*Client) ContainerExec ¶
func (*Client) ContainerGetMounts ¶
func (d *Client) ContainerGetMounts(containerName string) []types.MountPoint
ContainerGetMounts Returns a slice containing all the mounts to the given container.
func (*Client) ContainerList ¶
ContainerList Lists all running containers for a given site or all sites if no site is specified.
func (*Client) ContainerRestart ¶
func (*Client) ContainerRun ¶
func (d *Client) ContainerRun(config *ContainerConfig, randomPorts, localUser bool) (id string, err error)
func (*Client) ContainerRunAndClean ¶
func (d *Client) ContainerRunAndClean(config *ContainerConfig) (statusCode int64, body string, err error)
func (*Client) EnsureImage ¶
func (d *Client) EnsureImage(imageName string, updateDays int, consoleOutput *console.Console) (err error)
https://gist.github.com/miguelmota/4980b18d750fb3b1eb571c3e207b1b92 https://riptutorial.com/docker/example/31980/image-pulling-with-progress-bars--written-in-go
func (*Client) EnsureNetwork ¶
type ContainerAPIClient ¶
type ContainerAPIClient interface { ContainerCreate( ctx context.Context, config *containerTypes.Config, hostConfig *containerTypes.HostConfig, networkingConfig *networkTypes.NetworkingConfig, platform *specs.Platform, containerName string) (containerTypes.CreateResponse, error) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error ContainerStop(ctx context.Context, name string, options containerTypes.StopOptions) error ContainerWait( ctx context.Context, container string, condition containerTypes.WaitCondition) (<-chan containerTypes.WaitResponse, <-chan error) }
ContainerAPIClient defines API client methods for the containers.
type ContainerConfig ¶
type ExecResult ¶
type ExposedPorts ¶
type ImageAPIClient ¶
type ImageAPIClient interface { ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) ImageRemove(ctx context.Context, image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) }
ImageAPIClient defines API client methods for the images.
type NetworkAPIClient ¶
type NetworkAPIClient interface { NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) NetworkRemove(ctx context.Context, network string) error }
NetworkAPIClient defines API client methods for the networks.
type ViperClient ¶
type ViperClient interface { SetConfigName(in string) SetConfigType(in string) AddConfigPath(in string) ReadInConfig() error SafeWriteConfig() error GetTime(key string) time.Time Set(key string, value interface{}) WriteConfig() error }
ViperClient defines a mock Viper client for testing.