Documentation ¶
Index ¶
- type Containerizer
- type DockerContainerizer
- func (c *DockerContainerizer) ContainerCreate(info Info) (string, error)
- func (c *DockerContainerizer) ContainerExec(ctx context.Context, id string, cmd []string) chan error
- func (c *DockerContainerizer) ContainerGetIPsByInterface(id string, hostInterfaceName string) ([]net.IP, error)
- func (c *DockerContainerizer) ContainerGetPID(id string) (int, error)
- func (c *DockerContainerizer) ContainerRemove(id string) error
- func (c *DockerContainerizer) ContainerRun(id string) error
- func (c *DockerContainerizer) ContainerStop(id string) error
- func (c *DockerContainerizer) ContainerWait(id string) (int, error)
- type Info
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Containerizer ¶
type Containerizer interface { ContainerCreate(info Info) (id string, err error) // Creates the container with the given info and returns its ID ContainerGetPID(id string) (pid int, err error) // Returns the main PID (1) of the given container ContainerRemove(id string) error // Removes the given container ContainerRun(id string) error // Starts the given container ContainerStop(id string) error // Stops the given container ContainerWait(id string) (code int, err error) // Wait for the given container to stop, returning its exit code ContainerExec(ctx context.Context, id string, cmd []string) (result chan error) // Executes the given command with the given context in the given container and returns result in a chan (asynchronous) ContainerGetIPsByInterface(id string, interfaceName string) (ips []net.IP, err error) // Returns the given container IP corresponding to a host interface }
Containerizer represents a containerizing technology such as docker
type DockerContainerizer ¶
DockerContainerizer represents a docker containerizer
func NewDockerContainerizer ¶
func NewDockerContainerizer(socket string) (*DockerContainerizer, error)
NewDockerContainerizer initializes a new docker containerizer
func (*DockerContainerizer) ContainerCreate ¶
func (c *DockerContainerizer) ContainerCreate(info Info) (string, error)
ContainerCreate creates a new container (but do not start it)
func (*DockerContainerizer) ContainerExec ¶
func (c *DockerContainerizer) ContainerExec(ctx context.Context, id string, cmd []string) chan error
ContainerExec executes the given command in the given container with the given context It does it asynchronously, and returns a channel with an error (or nil if ok)
func (*DockerContainerizer) ContainerGetIPsByInterface ¶
func (c *DockerContainerizer) ContainerGetIPsByInterface(id string, hostInterfaceName string) ([]net.IP, error)
ContainerGetIPsByInterface returns the IPs of the container in the different networks. This is done by entering the container networking namespace, and returning the Ips that matches this interface.
func (*DockerContainerizer) ContainerGetPID ¶
func (c *DockerContainerizer) ContainerGetPID(id string) (int, error)
ContainerGetPID returns the PID of the given container
func (*DockerContainerizer) ContainerRemove ¶
func (c *DockerContainerizer) ContainerRemove(id string) error
ContainerRemove removes the given container
func (*DockerContainerizer) ContainerRun ¶
func (c *DockerContainerizer) ContainerRun(id string) error
ContainerRun launches a new container with the given containerizer
func (*DockerContainerizer) ContainerStop ¶
func (c *DockerContainerizer) ContainerStop(id string) error
ContainerStop stops the given container
func (*DockerContainerizer) ContainerWait ¶
func (c *DockerContainerizer) ContainerWait(id string) (int, error)
ContainerWait waits for the given container to stop and returns its exit code. This function is blocking.