Documentation
¶
Index ¶
- Constants
- func DockerHostAddr() string
- func EnsureDockerInstalled(ctx context.Context) error
- func IsDockerEnv() bool
- func RestartPolicyNo() container.RestartPolicy
- type DockerClient
- func (d *DockerClient) Cli() *client.Client
- func (d *DockerClient) Close() error
- func (d *DockerClient) ContainerInspect(ctx context.Context, name string) (types.ContainerJSON, error)
- func (d *DockerClient) HasImage(ctx context.Context, ref string) (bool, error)
- func (d *DockerClient) Info(ctx context.Context) (system.Info, error)
- func (d *DockerClient) InstanceLogs(ctx context.Context, containerName, tail string, follow bool) (io.ReadCloser, error)
- func (d *DockerClient) IsInstalled(ctx context.Context) bool
- func (d *DockerClient) IsInstanceRunning(ctx context.Context, name string) (bool, error)
- func (d *DockerClient) IsRunning(ctx context.Context) (bool, error)
- func (d *DockerClient) KillSignal(ctx context.Context, signal string) error
- func (d *DockerClient) KillSignalInstance(ctx context.Context, name, signal string) error
- func (d *DockerClient) ListImages(ctx context.Context, ref string) ([]image.Summary, error)
- func (d *DockerClient) Logs(ctx context.Context, tail string, follow bool) (io.ReadCloser, error)
- func (d *DockerClient) PullImage(ctx context.Context, ref string) (io.ReadCloser, error)
- func (d *DockerClient) RemoveContainer(ctx context.Context) error
- func (d *DockerClient) RemoveImage(ctx context.Context, imageID string) error
- func (d *DockerClient) RemoveInstance(ctx context.Context, name string) error
- func (d *DockerClient) ResolveHostPath(path string) string
- func (d *DockerClient) RunContainer(ctx context.Context, opts RunOptions) (string, error)
- func (d *DockerClient) RunInstance(ctx context.Context, opts InstanceRunOptions) (string, error)
- func (d *DockerClient) StopContainer(ctx context.Context, timeout int) error
- func (d *DockerClient) StopInstance(ctx context.Context, name string, timeout int) error
- func (d *DockerClient) UpdateRestartPolicy(ctx context.Context, policy container.RestartPolicy) error
- type InstanceRunOptions
- type RunOptions
Constants ¶
const ContainerName = "popugate-telemt"
ContainerName is the default container name.
Variables ¶
This section is empty.
Functions ¶
func DockerHostAddr ¶ added in v0.1.0
func DockerHostAddr() string
DockerHostAddr returns the address to reach the host from inside a container, or localhost when not running in Docker.
func EnsureDockerInstalled ¶
EnsureDockerInstalled installs Docker if not present.
func IsDockerEnv ¶ added in v0.1.0
func IsDockerEnv() bool
IsDockerEnv returns true if the current process runs inside a Docker container.
func RestartPolicyNo ¶
func RestartPolicyNo() container.RestartPolicy
RestartPolicyNo returns a "no" restart policy.
Types ¶
type DockerClient ¶
type DockerClient struct {
// contains filtered or unexported fields
}
DockerClient wraps the Docker Engine SDK.
func NewDockerClient ¶
func NewDockerClient() (*DockerClient, error)
NewDockerClient creates a new Docker client from environment.
func (*DockerClient) Cli ¶ added in v0.0.6
func (d *DockerClient) Cli() *client.Client
Cli returns the underlying Docker SDK client for advanced operations.
func (*DockerClient) Close ¶
func (d *DockerClient) Close() error
Close releases Docker client resources.
func (*DockerClient) ContainerInspect ¶
func (d *DockerClient) ContainerInspect(ctx context.Context, name string) (types.ContainerJSON, error)
ContainerInspect returns detailed container info.
func (*DockerClient) InstanceLogs ¶ added in v0.1.0
func (d *DockerClient) InstanceLogs(ctx context.Context, containerName, tail string, follow bool) (io.ReadCloser, error)
InstanceLogs returns logs for a specific instance container by name.
func (*DockerClient) IsInstalled ¶
func (d *DockerClient) IsInstalled(ctx context.Context) bool
IsInstalled checks if Docker is available.
func (*DockerClient) IsInstanceRunning ¶
IsInstanceRunning checks if an instance container is running.
func (*DockerClient) IsRunning ¶
func (d *DockerClient) IsRunning(ctx context.Context) (bool, error)
IsRunning checks if the proxy container is running.
func (*DockerClient) KillSignal ¶
func (d *DockerClient) KillSignal(ctx context.Context, signal string) error
KillSignal sends a signal to the container (for hot-reload).
func (*DockerClient) KillSignalInstance ¶
func (d *DockerClient) KillSignalInstance(ctx context.Context, name, signal string) error
KillSignalInstance sends a signal to a named instance container.
func (*DockerClient) ListImages ¶
ListImages returns all images matching a filter.
func (*DockerClient) Logs ¶
func (d *DockerClient) Logs(ctx context.Context, tail string, follow bool) (io.ReadCloser, error)
Logs returns container logs as a readcloser.
func (*DockerClient) PullImage ¶
func (d *DockerClient) PullImage(ctx context.Context, ref string) (io.ReadCloser, error)
PullImage pulls a Docker image from a registry.
func (*DockerClient) RemoveContainer ¶
func (d *DockerClient) RemoveContainer(ctx context.Context) error
RemoveContainer force-removes the container.
func (*DockerClient) RemoveImage ¶
func (d *DockerClient) RemoveImage(ctx context.Context, imageID string) error
RemoveImage removes an image by ID.
func (*DockerClient) RemoveInstance ¶
func (d *DockerClient) RemoveInstance(ctx context.Context, name string) error
RemoveInstance removes an instance container by name.
func (*DockerClient) ResolveHostPath ¶
func (d *DockerClient) ResolveHostPath(path string) string
ResolveHostPath translates a container-local path to a host-relative path if running inside a container with the data volume mounted.
func (*DockerClient) RunContainer ¶
func (d *DockerClient) RunContainer(ctx context.Context, opts RunOptions) (string, error)
RunContainer creates and starts the proxy container.
func (*DockerClient) RunInstance ¶
func (d *DockerClient) RunInstance(ctx context.Context, opts InstanceRunOptions) (string, error)
RunInstance creates and starts an instance container.
func (*DockerClient) StopContainer ¶
func (d *DockerClient) StopContainer(ctx context.Context, timeout int) error
StopContainer stops the proxy container.
func (*DockerClient) StopInstance ¶
StopInstance stops an instance container by name.
func (*DockerClient) UpdateRestartPolicy ¶
func (d *DockerClient) UpdateRestartPolicy(ctx context.Context, policy container.RestartPolicy) error
UpdateRestartPolicy changes the container restart policy.
type InstanceRunOptions ¶
type InstanceRunOptions struct {
RunOptions
Name string
Port int
}
InstanceRunOptions for multi-port instances.