Documentation
¶
Index ¶
- func ExecCapture(ctx context.Context, cli *DockerClient, container, workingDir string, ...) (string, error)
- func GetConfigEnv(ctx context.Context, cli DockerAPI, containerName, envName string) (string, error)
- func GetDatabaseUris(c *config.Context) (string, string, error)
- func GetSecret(ctx context.Context, cli DockerAPI, c *config.Context, ...) (string, error)
- func TrimContainerName(names []string) string
- type DockerAPI
- type DockerClient
- func (d *DockerClient) Close() error
- func (d *DockerClient) Exec(ctx context.Context, opts ExecOptions) (int, error)
- func (d *DockerClient) ExecInteractive(ctx context.Context, containerID string, cmd []string) (int, error)
- func (d *DockerClient) ExecSimple(ctx context.Context, containerID string, cmd []string) (int, error)
- func (d *DockerClient) GetContainerName(c *config.Context, service string) (string, error)
- func (d *DockerClient) GetContainerNameContext(ctx context.Context, c *config.Context, service string) (string, error)
- func (d *DockerClient) GetServiceIp(ctx context.Context, c *config.Context, containerName string) (string, error)
- type ExecOptions
- type ProjectSummary
- type ServiceSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecCapture ¶ added in v0.13.4
func ExecCapture(ctx context.Context, cli *DockerClient, container, workingDir string, cmd []string) (string, error)
ExecCapture runs a command in a container and returns its stdout. stderr is used as the error detail when the command exits non-zero. workingDir may be empty to use the container's default.
func GetConfigEnv ¶
func GetDatabaseUris ¶ added in v0.2.0
GetDatabaseUris constructs MySQL and SSH connection URIs for database tools like Sequel Ace Returns: mysqlURI, sshURI, error
func TrimContainerName ¶ added in v0.13.3
Types ¶
type DockerAPI ¶
type DockerAPI interface {
ContainerInspect(ctx context.Context, container string) (dockercontainer.InspectResponse, error)
ContainerList(ctx context.Context, options dockercontainer.ListOptions) ([]dockercontainer.Summary, error)
}
DockerAPI abstracts the Docker client functionality needed by our package.
type DockerClient ¶
type DockerClient struct {
CLI DockerAPI
SshCli *ssh.Client
// contains filtered or unexported fields
}
func GetDockerCli ¶
func GetDockerCli(activeCtx *config.Context) (*DockerClient, error)
func GetDockerCliWithSSH ¶ added in v0.12.0
func (*DockerClient) Close ¶
func (d *DockerClient) Close() error
func (*DockerClient) Exec ¶
func (d *DockerClient) Exec(ctx context.Context, opts ExecOptions) (int, error)
Exec executes a command in a container using the DockerClient
func (*DockerClient) ExecInteractive ¶
func (d *DockerClient) ExecInteractive(ctx context.Context, containerID string, cmd []string) (int, error)
ExecInteractive executes an interactive command with TTY
func (*DockerClient) ExecSimple ¶
func (d *DockerClient) ExecSimple(ctx context.Context, containerID string, cmd []string) (int, error)
ExecSimple executes a simple command and returns the exit code
func (*DockerClient) GetContainerName ¶
func (*DockerClient) GetContainerNameContext ¶ added in v0.12.0
func (*DockerClient) GetServiceIp ¶
type ExecOptions ¶
type ExecOptions struct {
// Container is the container ID or name
Container string
// Cmd is the command to execute
Cmd []string
// Env is additional environment variables
Env []string
// WorkingDir is the working directory
WorkingDir string
// User to run as
User string
// AttachStdin attaches stdin
AttachStdin bool
// AttachStdout attaches stdout
AttachStdout bool
// AttachStderr attaches stderr
AttachStderr bool
// Tty allocates a pseudo-TTY
Tty bool
// Stdin is the input stream
Stdin io.Reader
// Stdout is the output stream
Stdout io.Writer
// Stderr is the error stream
Stderr io.Writer
}
ExecOptions holds options for executing a command in a container
type ProjectSummary ¶ added in v0.10.0
type ProjectSummary struct {
Running int
Total int
Healthy int
Stopped int
CPUPercent float64
MemoryBytes uint64
MemoryLimitBytes uint64
HostLoad1 float64
HostCPUCount int
DiskAvailable uint64
DiskTotal uint64
NetworkRXBytes uint64
NetworkTXBytes uint64
CollectedAt time.Time
Services []ServiceSummary
Status string
}
func SummarizeProject ¶ added in v0.10.0
func SummarizeProject(ctxCfg *config.Context) (ProjectSummary, error)
func SummarizeProjectWithClient ¶ added in v0.10.0
Click to show internal directories.
Click to hide internal directories.