docker

package
v0.2.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Kubeconfig              = f.FilePathJoin(f.UserHomeDir(), ".flyte", "k3s", "k3s.yaml")
	SuccessMessage          = "Deploying Flyte..."
	ImageName               = "cr.flyte.org/flyteorg/flyte-sandbox:dind"
	FlyteSandboxClusterName = "flyte-sandbox"
	Environment             = []string{"SANDBOX=1", "KUBERNETES_API_PORT=30086", "FLYTE_HOST=localhost:30081", "FLYTE_AWS_ENDPOINT=http://localhost:30084"}
	Source                  = "/root"
	K3sDir                  = "/etc/rancher/"
	Client                  Docker
	Volumes                 = []mount.Mount{
		{
			Type:   mount.TypeBind,
			Source: f.FilePathJoin(f.UserHomeDir(), ".flyte"),
			Target: K3sDir,
		},
	}
	ExecConfig = types.ExecConfig{
		AttachStderr: true,
		Tty:          true,
		WorkingDir:   Source,
		AttachStdout: true,
		Cmd:          []string{},
	}
	StdWriterPrefixLen = 8
	StartingBufLen     = 32*1024 + StdWriterPrefixLen + 1
)

Functions

func ExecCommend added in v0.1.29

func ExecCommend(ctx context.Context, cli Docker, containerID string, command []string) (types.IDResponse, error)

ExecCommend will execute a command in container and returns an execution id

func GetSandbox

func GetSandbox(ctx context.Context, cli Docker) *types.Container

GetSandbox will return sandbox container if it exist

func GetSandboxPorts

func GetSandboxPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error)

GetSandboxPorts will return sandbox ports

func InspectExecResp added in v0.1.29

func InspectExecResp(ctx context.Context, cli Docker, containerID string) error

func PullDockerImage

func PullDockerImage(ctx context.Context, cli Docker, image string) error

PullDockerImage will Pull docker image

func ReadLogs

func ReadLogs(ctx context.Context, cli Docker, id string) (*bufio.Scanner, error)

ReadLogs will return io scanner for reading the logs of a container

func RemoveSandbox

func RemoveSandbox(ctx context.Context, cli Docker, reader io.Reader) error

RemoveSandbox will remove sandbox container if exist

func StartContainer

func StartContainer(ctx context.Context, cli Docker, volumes []mount.Mount, exposedPorts map[nat.Port]struct{}, portBindings map[nat.Port][]nat.PortBinding, name, image string) (string, error)

StartContainer will create and start docker container

func WaitForSandbox

func WaitForSandbox(reader *bufio.Scanner, message string) bool

WaitForSandbox will wait until it doesn't get success message

Types

type Docker

type Docker interface {
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.ContainerCreateCreatedBody, error)
	ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
	ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
	ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error)
	ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
	ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
}

func GetDockerClient

func GetDockerClient() (Docker, error)

GetDockerClient will returns the docker client

type FlyteDocker

type FlyteDocker struct {
	*client.Client
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL