container

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const SandboxServiceName = "workspace"

Variables

This section is empty.

Functions

func DetectProjectNetwork

func DetectProjectNetwork(ctx context.Context, dockerCLI command.Cli, suffix string) string

DetectProjectNetwork checks whether a Docker network named "<cwd-project>_<suffix>" exists. Returns the full network name if found, "" otherwise. If suffix is empty, "default" is used.

func DownProject

func DownProject(ctx context.Context, dockerCLI command.Cli, projectName string) error

DownProject stops and removes a compose project by name only. It needs no build context or project spec, so it can tear down a sandbox for any directory regardless of local config.

func NewSandboxProject

func NewSandboxProject(pid, uid, gid int, buildContext, dockerfile, image string, allowExternal bool, externalNetwork string) (*composetypes.Project, error)

func NormalizeProjectName

func NormalizeProjectName(name string) string

NormalizeProjectName converts a directory name to a Docker Compose project name.

func ProjectSandboxName

func ProjectSandboxName(cwd string) string

Types

type CleanResult

type CleanResult struct {
	Containers int
	Networks   int
}

type ComposeExecutor

type ComposeExecutor struct {
	// contains filtered or unexported fields
}

func NewComposeExecutor

func NewComposeExecutor(dockerCLI command.Cli, project *composetypes.Project) *ComposeExecutor

func (*ComposeExecutor) CleanStale

func (e *ComposeExecutor) CleanStale(ctx context.Context) (CleanResult, error)

func (*ComposeExecutor) Down

func (e *ComposeExecutor) Down(ctx context.Context) error

func (*ComposeExecutor) IsRunning

func (e *ComposeExecutor) IsRunning(ctx context.Context) (bool, error)

func (*ComposeExecutor) RunContainer

func (e *ComposeExecutor) RunContainer(ctx context.Context, argv []string, env []string, stdin io.Reader, stdout, stderr io.Writer) (int, error)

func (*ComposeExecutor) StartBackground

func (e *ComposeExecutor) StartBackground(ctx context.Context)

StartBackground runs Up in a goroutine. Call WaitReady before issuing commands to ensure the sandbox is available.

func (*ComposeExecutor) Up

func (e *ComposeExecutor) Up(ctx context.Context) error

func (*ComposeExecutor) WaitReady

func (e *ComposeExecutor) WaitReady(ctx context.Context) error

WaitReady blocks until StartBackground completes or ctx is cancelled.

Jump to

Keyboard shortcuts

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