Documentation
¶
Index ¶
- func ContainerCreate(config *container.Config, hostConfig *container.HostConfig, ...) (container.CreateResponse, error)
- func ContainerDelete(name string, opts container.RemoveOptions) error
- func ContainerKill(name string) error
- func ContainerRestart(name string) error
- func ContainerStart(name string, opts container.StartOptions) error
- func ContainerStop(name string) error
- func ContainerWait(name string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
- func CopyGitStackToHost(src, dst string, stackID int, stackName, assetPath string) error
- func CreateSnapshot(edgeKey string) (*portainer.DockerSnapshot, error)
- func GetContainerLogs(containerName, tail, since, until string) ([]byte, []byte, error)
- func GetContainersWithLabel(value string) (r []types.Container, err error)
- func GetLiveContainerLogs(containerName, since, until, tail string) (*io.PipeReader, *io.PipeReader, error)
- func GetVolumeMountpoint(volumeID string) (string, error)
- func ImageDelete(name string, opts image.RemoveOptions) (r []image.DeleteResponse, err error)
- func ImagePull(refStr string, options image.PullOptions) (io.ReadCloser, error)
- func NewClient() (*client.Client, error)
- func NewClientWithoutTimeout() (*client.Client, error)
- func RemoveGitStackFromHost(src, dst string, stackID int, stackName string) error
- func VolumeDelete(name string, force bool) error
- type CleanupClient
- type CleanupClientFactory
- type InfoService
- func (service InfoService) GetContainerIpFromDockerEngine(containerName string, ignoreNonSwarmNetworks bool) (string, error)
- func (service InfoService) GetRuntimeConfigurationFromDockerEngine() (*agent.RuntimeConfig, error)
- func (service InfoService) GetServiceNameFromDockerEngine(containerName string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerCreate ¶
func ContainerCreate( config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string, ) (container.CreateResponse, error)
func ContainerDelete ¶
func ContainerDelete(name string, opts container.RemoveOptions) error
func ContainerKill ¶
func ContainerRestart ¶
func ContainerStart ¶
func ContainerStart(name string, opts container.StartOptions) error
func ContainerStop ¶
func ContainerWait ¶
func ContainerWait(name string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
func CopyGitStackToHost ¶
CopyGitStackToHost copies src folder to the dst folder on the host
func CreateSnapshot ¶
func CreateSnapshot(edgeKey string) (*portainer.DockerSnapshot, error)
func GetContainerLogs ¶
func GetContainersWithLabel ¶
func GetLiveContainerLogs ¶
func GetLiveContainerLogs(containerName, since, until, tail string) (*io.PipeReader, *io.PipeReader, error)
func GetVolumeMountpoint ¶
GetVolumeMountpoint returns the Mountpoint of the named volume as reported by the Docker daemon (e.g. /mnt/docker-data/volumes/test_volume/_data).
func ImageDelete ¶
func ImageDelete(name string, opts image.RemoveOptions) (r []image.DeleteResponse, err error)
func ImagePull ¶
func ImagePull(refStr string, options image.PullOptions) (io.ReadCloser, error)
func NewClientWithoutTimeout ¶
func RemoveGitStackFromHost ¶
RemoveGitStackFromHost removes the copy of src folder on the host
func VolumeDelete ¶
Types ¶
type CleanupClient ¶
type CleanupClient interface {
// DiskUsage returns Docker's own accounting of disk space used by images,
// containers, volumes, and build cache (equivalent to "docker system df").
DiskUsage(ctx context.Context, options dockertypes.DiskUsageOptions) (dockertypes.DiskUsage, error)
Close() error
}
CleanupClient is the subset of the Docker client API used for storage usage queries. *client.Client already satisfies this interface, so production code continues using the existing NewClient() path while tests can inject a mock.
func NewCleanupClient ¶
func NewCleanupClient() (CleanupClient, error)
NewCleanupClient creates a new CleanupClient backed by the production Docker client.
type CleanupClientFactory ¶
type CleanupClientFactory func() (CleanupClient, error)
CleanupClientFactory is a function that creates a CleanupClient. Tests can provide a factory that returns a mock CleanupClient.
type InfoService ¶
type InfoService struct{}
DockerInfoService is a service used to retrieve information from a Docker environment using the Docker library.
func NewInfoService ¶
func NewInfoService() InfoService
NewInfoService returns a pointer to an instance of DockerInfoService
func (InfoService) GetContainerIpFromDockerEngine ¶
func (service InfoService) GetContainerIpFromDockerEngine(containerName string, ignoreNonSwarmNetworks bool) (string, error)
GetContainerIpFromDockerEngine is used to retrieve the IP address of the container through Docker. It will inspect the container to retrieve the networks associated to the container and returns the IP associated to the first network found that is not an ingress network. If the ignoreNonSwarmNetworks parameter is specified, it will also ignore non Swarm scoped networks.
func (InfoService) GetRuntimeConfigurationFromDockerEngine ¶
func (service InfoService) GetRuntimeConfigurationFromDockerEngine() (*agent.RuntimeConfig, error)
GetRuntimeConfigurationFromDockerEngine retrieves information from a Docker environment and returns a map of labels.
func (InfoService) GetServiceNameFromDockerEngine ¶
func (service InfoService) GetServiceNameFromDockerEngine(containerName string) (string, error)
GetServiceNameFromDockerEngine is used to return the name of the Swarm service the agent is part of. The service name is retrieved through container labels.