Documentation
¶
Index ¶
- 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)
- 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) GetServiceIp(ctx context.Context, c *config.Context, containerName string) (string, error)
- type ExecOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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 (*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) 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
Click to show internal directories.
Click to hide internal directories.