Documentation ¶
Index ¶
- func CheckContainerStatus(containerName string) (bool, bool, error)
- func CheckIfImageExists(imageID string) (bool, error)
- func CheckIfInitialized() error
- func CheckIfNetworkExists(networkName string) (bool, error)
- func ContainerCommandParamsToConfig(cmdParams ContainerCommandParams) (*container.Config, error)
- func CreateContainer(cmdParams ContainerCommandParams) (string, error)
- func DeleteContainerImage(imageID string) error
- func ExportImageFromEngine(imageID string) (io.ReadCloser, error)
- func GetAllImages() ([]image.Summary, error)
- func GetContainerInfo(containerID string) (types.ContainerJSON, error)
- func GetContainerLogs(containerID string) (string, error)
- func GetContainerName(containerID string) (string, error)
- func GetImageIDByName(imageName string) (string, error)
- func GetImageInfo(imageID string) (*types.ImageInspect, error)
- func GetImageName(imageID string) (string, error)
- func GetImageSize(imageID string) (int64, error)
- func GetImageSizeFromReader(imageID string) (int64, error)
- func GetImageTag(imageID string) (string, error)
- func GetNetworkInfo(networkName string) (types.NetworkResource, error)
- func ImportImageToEngine(imageFilePath string) (string, error)
- func InitializeClient(config *Config) error
- func IsRunningInContainer() bool
- func ListContainerImages() ([]image.Summary, error)
- func ListContainers(ctx context.Context) ([]types.Container, error)
- func ListRunningContainers() ([]types.Container, error)
- func RemoveContainer(containerID string) error
- func RenameContainer(containerID string, newName string) error
- func StartContainer(containerID string) error
- func StopContainer(containerID string) error
- func StopContainerGracefully(containerID string, timeoutDuration time.Duration) (bool, error)
- func StopContainerRagefully(containerID string) error
- func UpdateContainerConfig(containerID string, newConfig *container.Config, ...) error
- func WhoAmI() (string, error)
- type Config
- type ContainerCommandParams
- type PortMapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckContainerStatus ¶
CheckContainerStatus checks if a container with the given name exists and is running
func CheckIfImageExists ¶
CheckIfImageExists checks if an image exists in the Docker engine
func CheckIfInitialized ¶
func CheckIfInitialized() error
func CheckIfNetworkExists ¶
func ContainerCommandParamsToConfig ¶
func ContainerCommandParamsToConfig(cmdParams ContainerCommandParams) (*container.Config, error)
func CreateContainer ¶
func CreateContainer(cmdParams ContainerCommandParams) (string, error)
CreateContainer creates a container with the given parameters
func DeleteContainerImage ¶
DeleteContainerImage deletes an image from the Docker engine
func ExportImageFromEngine ¶
func ExportImageFromEngine(imageID string) (io.ReadCloser, error)
ExportImageFromEngine exports an image from the Docker engine and returns it as an io.Reader
func GetContainerInfo ¶
func GetContainerInfo(containerID string) (types.ContainerJSON, error)
GetContainerInfo returns information about a container
func GetContainerLogs ¶
GetContainerLogs returns the logs of a container
func GetContainerName ¶
GetContainerName returns the name of a container
func GetImageIDByName ¶
func GetImageInfo ¶
func GetImageInfo(imageID string) (*types.ImageInspect, error)
From an ID, get the all the information about the image
func GetImageName ¶
GetImageName returns the name of an image
func GetImageSize ¶
GetImageSize returns the size of an image
func GetImageSizeFromReader ¶
func GetImageTag ¶
GetImageTag returns the tag of an image
func GetNetworkInfo ¶
func GetNetworkInfo(networkName string) (types.NetworkResource, error)
GetNetworkInfo returns information about a network
func ImportImageToEngine ¶
ImportImageToEngine imports an image to the Docker engine and returns the image ID
func InitializeClient ¶
func IsRunningInContainer ¶
func IsRunningInContainer() bool
func ListContainerImages ¶
func ListRunningContainers ¶
ListRunningContainers lists all running containers
func RenameContainer ¶
RenameContainer renames a container with the given name
func StartContainer ¶
StartContainer starts a container
func StopContainer ¶
StopContainer try to stop a container gracefully, if it fails, it will stop it forcefully
func StopContainerGracefully ¶
StopContainerGracefully stops a container by sending a SIGTERM and waiting for it to stop
func StopContainerRagefully ¶
StopContainerRagefully stops a container by sending a SIGKILL
func UpdateContainerConfig ¶
func UpdateContainerConfig(containerID string, newConfig *container.Config, newHostConfig *container.HostConfig, newNetworkingConfig *network.NetworkingConfig) error
UpdateContainerConfig updates the configuration of an existing container.
Types ¶
type ContainerCommandParams ¶
type ContainerCommandParams struct { ContainerName string ContainerHost string Domain string ServiceName string IsSSL bool EnvVar string ImageName string ImageID string PortMappings []PortMapping Volumes []string Labels []string Network string Restart string Environment []string TraefikEntryPoint string }
type PortMapping ¶
func ParsePortsSpecs ¶
func ParsePortsSpecs(portsSpecs []string) ([]PortMapping, error)
ParsePortsSpecs receives a slice of strings in the format "hostPort:containerPort/Protocol" and returns a slice of PortMapping structs