docker

package
v0.0.0-...-ee63aef Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultImage = "ubuntu:latest"
)
View Source
const (
	GboxExtraLabelPrefix = "gbox.extra"
)

Variables

This section is empty.

Functions

func EnsureImageTag

func EnsureImageTag(image string) string

EnsureImageTag ensures an image name has a tag, using various fallback strategies

func GetCommand

func GetCommand(cmd string, args []string) []string

GetCommand returns the command to run, falling back to default if none specified

func GetEnvVars

func GetEnvVars(env map[string]string) []string

GetEnvVars converts environment variables map to string slice

func GetImage

func GetImage(image string) string

func JoinArgs

func JoinArgs(args []string) string

JoinArgs converts a string array to a JSON string

func MapToEnv

func MapToEnv(env map[string]string) []string

MapToEnv converts a map of environment variables to a slice of "key=value" strings

func PrepareLabels

func PrepareLabels(boxID string, p *model.LinuxAndroidBoxCreateParam) map[string]string

func ProcessPullProgress

func ProcessPullProgress(reader io.Reader, writer io.Writer) error

ProcessPullProgress reads Docker pull progress from reader and writes to the writer Returns error if encountered

func WaitForResponse

func WaitForResponse(reader io.Reader) ([]byte, error)

WaitForResponse reads from a reader until EOF and returns any error encountered

Types

type ImageService

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

ImageService manages Docker images in the background via triggers.

func NewImageService

func NewImageService(dockerClient *client.Client, logger *logger.Logger) *ImageService

NewImageService creates a new ImageService.

func (*ImageService) PruneImages

func (s *ImageService) PruneImages(imageRef string)

PruneImages sends a trigger to prune old versions of an image.

func (*ImageService) PullImage

func (s *ImageService) PullImage(imageRef string, writer io.Writer)

PullImage sends a trigger to pull an image.

func (*ImageService) Start

func (s *ImageService) Start()

Start begins the background image management goroutine.

func (*ImageService) Stop

func (s *ImageService) Stop()

Stop gracefully stops the image management service.

type Service

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

Service implements the box service interface using Docker.

func NewService

func NewService(tracker tracker.AccessTracker) (*Service, error)

NewService creates a new Docker service instance.

func (*Service) BoxActionClick

func (s *Service) BoxActionClick(ctx context.Context, id string, params *model.BoxActionClickParams) (*model.BoxActionClickResult, error)

func (*Service) BoxActionDrag

func (s *Service) BoxActionDrag(ctx context.Context, id string, params *model.BoxActionDragParams) (*model.BoxActionDragResult, error)

func (*Service) BoxActionMove

func (s *Service) BoxActionMove(ctx context.Context, id string, params *model.BoxActionMoveParams) (*model.BoxActionMoveResult, error)

func (*Service) BoxActionPress

func (s *Service) BoxActionPress(ctx context.Context, id string, params *model.BoxActionPressParams) (*model.BoxActionPressResult, error)

func (*Service) BoxActionScreenshot

func (s *Service) BoxActionScreenshot(ctx context.Context, id string, params *model.BoxActionScreenshotParams) (*model.BoxActionScreenshotResult, error)

func (*Service) BoxActionScroll

func (s *Service) BoxActionScroll(ctx context.Context, id string, params *model.BoxActionScrollParams) (*model.BoxActionScrollResult, error)

func (*Service) BoxActionTouch

func (s *Service) BoxActionTouch(ctx context.Context, id string, params *model.BoxActionTouchParams) (*model.BoxActionTouchResult, error)

func (*Service) BoxActionType

func (s *Service) BoxActionType(ctx context.Context, id string, params *model.BoxActionTypeParams) (*model.BoxActionTypeResult, error)

func (*Service) Close

func (s *Service) Close() error

Close gracefully shuts down the service.

func (*Service) CreateAndroidBox

func (s *Service) CreateAndroidBox(ctx context.Context, params *model.AndroidBoxCreateParam) (*model.Box, error)

not implemented

func (*Service) CreateLinuxBox

func (s *Service) CreateLinuxBox(ctx context.Context, params *model.LinuxAndroidBoxCreateParam) (*model.Box, error)

CreateLinuxBox creates an Alpine Linux box with specific parameters

func (*Service) Delete

Delete implements Service.Delete

func (*Service) DeleteAll

DeleteAll implements Service.DeleteAll

func (*Service) Exec

Exec implements Service.Exec

func (*Service) ExecWS

func (s *Service) ExecWS(ctx context.Context, id string, params *model.BoxExecWSParams, wsConn *websocket.Conn) (*model.BoxExecResult, error)

ExecWS implements Service.ExecWS for WebSocket connections

func (*Service) ExtractArchive

func (s *Service) ExtractArchive(ctx context.Context, id string, req *model.BoxArchiveExtractParams) error

ExtractArchive implements Service.ExtractArchive

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (*model.Box, error)

Get implements Service.Get

func (*Service) GetArchive

GetArchive implements Service.GetArchive

func (*Service) GetExternalPort

func (s *Service) GetExternalPort(ctx context.Context, id string, internalPort int) (int, error)

GetExternalPort implements Service.GetExternalPort

func (*Service) HeadArchive

HeadArchive implements Service.HeadArchive

func (*Service) List

func (s *Service) List(ctx context.Context, params *model.BoxListParams) (*model.BoxListResult, error)

List implements Service.List

func (*Service) ListFiles

func (s *Service) ListFiles(ctx context.Context, id string, params *model.BoxFileListParams) (*model.BoxFileListResult, error)

ListFiles lists files in a directory within a container

func (*Service) ReadFile

func (s *Service) ReadFile(ctx context.Context, id string, params *model.BoxFileReadParams) (*model.BoxFileReadResult, error)

ReadFile reads the content of a file within a container

func (*Service) Reclaim

func (s *Service) Reclaim(ctx context.Context) (*model.BoxReclaimResult, error)

Reclaim implements Service.Reclaim

func (*Service) RunCode

RunCode implements Service.RunCode

func (*Service) Start

func (s *Service) Start(ctx context.Context, id string) (*model.BoxStartResult, error)

Start implements Service.Start

func (*Service) Stop

func (s *Service) Stop(ctx context.Context, id string) (*model.BoxStopResult, error)

Stop implements Service.Stop

func (*Service) WriteFile

func (s *Service) WriteFile(ctx context.Context, id string, params *model.BoxFileWriteParams) (*model.BoxFileWriteResult, error)

WriteFile writes content to a file within a container

Jump to

Keyboard shortcuts

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