Documentation ¶
Overview ¶
Copyright 2022. Motty Cohen
Docker engine client library wrapper ¶
Copyright 2022. Motty Cohen
Docker container specification
Index ¶
- type DockerClient
- func (c *DockerClient) Close() error
- func (c *DockerClient) CreateContainer(image string) *DockerContainer
- func (c *DockerClient) FindContainerByName(name string) (containerID string, err error)
- func (c *DockerClient) GetContainerState(containerID string) (string, error)
- func (c *DockerClient) ListContainersByLabel(label, value string) (result []string, err error)
- func (c *DockerClient) ListContainersByState(state string) (result []string, err error)
- func (c *DockerClient) RemoveContainer(containerID string) error
- type DockerContainer
- func (c *DockerContainer) AutoRemove(value bool) *DockerContainer
- func (c *DockerContainer) EntryPoint(args ...string) *DockerContainer
- func (c *DockerContainer) Label(label, value string) *DockerContainer
- func (c *DockerContainer) Labels(label map[string]string) *DockerContainer
- func (c *DockerContainer) Name(value string) *DockerContainer
- func (c *DockerContainer) Port(external, internal string) *DockerContainer
- func (c *DockerContainer) Ports(ports map[string]string) *DockerContainer
- func (c *DockerContainer) Run() (containerID string, err error)
- func (c *DockerContainer) Var(key, value string) *DockerContainer
- func (c *DockerContainer) Vars(vars map[string]string) *DockerContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
General File utils
func NewDockerClient ¶
func NewDockerClient() (*DockerClient, error)
New creates a docker engine client
func (*DockerClient) Close ¶
func (c *DockerClient) Close() error
Close should close the underlying client library instance and free allocated resources
func (*DockerClient) CreateContainer ¶
func (c *DockerClient) CreateContainer(image string) *DockerContainer
DefineContainer begins defining a docker container via a fluent interface.
func (*DockerClient) FindContainerByName ¶
func (c *DockerClient) FindContainerByName(name string) (containerID string, err error)
FindContainerByName returns container ID from its name, or error if the container was not found.
func (*DockerClient) GetContainerState ¶
func (c *DockerClient) GetContainerState(containerID string) (string, error)
RemoveContainer stop, kill and remove the container
func (*DockerClient) ListContainersByLabel ¶
func (c *DockerClient) ListContainersByLabel(label, value string) (result []string, err error)
ListContainersByLabel returns list of containers IDs matching the provided label, and it's value
func (*DockerClient) ListContainersByState ¶
func (c *DockerClient) ListContainersByState(state string) (result []string, err error)
ListContainersByLabel returns list of containers IDs matching the provided state
func (*DockerClient) RemoveContainer ¶
func (c *DockerClient) RemoveContainer(containerID string) error
RemoveContainer stop, kill and remove the container
type DockerContainer ¶
type DockerContainer struct {
// contains filtered or unexported fields
}
DockerContainer is used to construct docker container spec for the docker engine.
func (*DockerContainer) AutoRemove ¶
func (c *DockerContainer) AutoRemove(value bool) *DockerContainer
AutoRemove determines whether to automatically remove the container when it has stopped
func (*DockerContainer) EntryPoint ¶
func (c *DockerContainer) EntryPoint(args ...string) *DockerContainer
EntryPoint sets the entrypoint arguments of the container.
func (*DockerContainer) Label ¶
func (c *DockerContainer) Label(label, value string) *DockerContainer
Label adds custom label
func (*DockerContainer) Labels ¶
func (c *DockerContainer) Labels(label map[string]string) *DockerContainer
Labels adds multiple labels
func (*DockerContainer) Name ¶
func (c *DockerContainer) Name(value string) *DockerContainer
Name sets the container name.
func (*DockerContainer) Port ¶
func (c *DockerContainer) Port(external, internal string) *DockerContainer
Port adds a port mapping
func (*DockerContainer) Ports ¶
func (c *DockerContainer) Ports(ports map[string]string) *DockerContainer
Ports adds multiple port mappings
func (*DockerContainer) Run ¶
func (c *DockerContainer) Run() (containerID string, err error)
Run creates and runs the container, returning the container ID.
func (*DockerContainer) Var ¶
func (c *DockerContainer) Var(key, value string) *DockerContainer
Var adds an environment variable
func (*DockerContainer) Vars ¶
func (c *DockerContainer) Vars(vars map[string]string) *DockerContainer
Vars adds multiple environment variables