daemon

package
v0.0.0-...-db9234b Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxImageResults int = 10

MaxImageResults represents the maximum number of results from a search.

Functions

This section is empty.

Types

type DockerInterface

type DockerInterface struct {
	Client     *client.Client
	Containers []types.Container
	Images     []types.ImageSummary
	Info       types.Info
	Networks   []types.NetworkResource
	Volumes    []*types.Volume
}

DockerInterface is our primary source of information about the Docker daemon and associated containers, images, networks, and volumes.

func NewInterface

func NewInterface(ctx context.Context) (*DockerInterface, error)

NewInterface returns a DockerInterface with information about the Docker daemon and all containers, images, networks, and volumes.

func (*DockerInterface) ConnectNetwork

func (di *DockerInterface) ConnectNetwork(ctx context.Context, net, container string) error

ConnectNetwork connects a container to a network.

func (*DockerInterface) DisconnectNetwork

func (di *DockerInterface) DisconnectNetwork(ctx context.Context, net, container string) error

DisconnectNetwork removes a container from a network.

func (*DockerInterface) InspectContainer

func (di *DockerInterface) InspectContainer(ctx context.Context,
	id string) (types.ContainerJSON, error)

InspectContainer returns the JSON file generated by the Docker Engine for the given container.

func (*DockerInterface) NewContainer

func (di *DockerInterface) NewContainer(ctx context.Context,
	opts map[string]string) (string, error)

NewContainer creates a new container with the provided options and returns the container's ID.

func (*DockerInterface) NewNetwork

func (di *DockerInterface) NewNetwork(ctx context.Context, opts map[string]string) (string, error)

NewNetwork creates a new network with the provided options and returns the network's ID.

func (*DockerInterface) NewVolume

func (di *DockerInterface) NewVolume(ctx context.Context, opts map[string]string) (string, error)

NewVolume creates a new volume with the provided options and returns the volume's name.

func (*DockerInterface) NumContainers

func (di *DockerInterface) NumContainers() int

NumContainers returns the current number of containers.

func (*DockerInterface) NumImages

func (di *DockerInterface) NumImages() int

NumImages return the number of images.

func (*DockerInterface) NumNetworks

func (di *DockerInterface) NumNetworks() int

NumNetworks returns the current number of networks.

func (*DockerInterface) NumVolumes

func (di *DockerInterface) NumVolumes() int

NumVolumes returns the current number of volumes.

func (*DockerInterface) PullImage

func (di *DockerInterface) PullImage(ctx context.Context, img string) error

PullImage pulls the image with the given img name.

func (*DockerInterface) RefreshContainers

func (di *DockerInterface) RefreshContainers(ctx context.Context) error

RefreshContainers updates the DockerInterface's Containers fields with the latest information from the Docker API.

func (*DockerInterface) RefreshImages

func (di *DockerInterface) RefreshImages(ctx context.Context) error

RefreshImages updates the DockerInterface's Images field with the latest information from the Docker API.

func (*DockerInterface) RefreshInfo

func (di *DockerInterface) RefreshInfo(ctx context.Context) error

RefreshInfo updates the DockerInterface's Info field with the latest information from the Docker API.

func (*DockerInterface) RefreshNetworks

func (di *DockerInterface) RefreshNetworks(ctx context.Context) error

RefreshNetworks updates the DockerInterface's Networks field with the latest information from the Docker API.

func (*DockerInterface) RefreshVolumes

func (di *DockerInterface) RefreshVolumes(ctx context.Context) error

RefreshVolumes updates the DockerInterface's Volumes field with the latest information from the Docker API.

func (*DockerInterface) RemoveContainer

func (di *DockerInterface) RemoveContainer(ctx context.Context, id string) error

RemoveContainer removes a container.

func (*DockerInterface) RemoveImage

func (di *DockerInterface) RemoveImage(ctx context.Context, id string) error

RemoveImage removes an image. id can be the ID or the image name.

func (*DockerInterface) RemoveNetwork

func (di *DockerInterface) RemoveNetwork(ctx context.Context, id string) error

RemoveNetwork removes a network.

func (*DockerInterface) RemoveVolume

func (di *DockerInterface) RemoveVolume(ctx context.Context, id string) error

RemoveVolume removes a volume.

func (*DockerInterface) RenameContainer

func (di *DockerInterface) RenameContainer(ctx context.Context,
	id string, name string) error

RenameContainer renames a container to name.

func (*DockerInterface) RestartContainer

func (di *DockerInterface) RestartContainer(ctx context.Context, id string) error

RestartContainer restarts a running container.

func (*DockerInterface) SearchImage

func (di *DockerInterface) SearchImage(ctx context.Context, image string) ([]registry.SearchResult, error)

SearchImage searches the registry for the given image.

func (*DockerInterface) StartContainer

func (di *DockerInterface) StartContainer(ctx context.Context, id string) error

StartContainer starts a stopped container.

func (*DockerInterface) StopContainer

func (di *DockerInterface) StopContainer(ctx context.Context, id string) error

StopContainer stops a running container.

type ResourceRefreshError

type ResourceRefreshError struct {
	Resource string
	Err      error
}

ResourceRefreshError is returned whenever a container, image, info, network, or volume refresh fails.

func (*ResourceRefreshError) Error

func (r *ResourceRefreshError) Error() string

Error is called whenever the daemon fails to send us an updated resource list.

Jump to

Keyboard shortcuts

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