containers

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImage

func BuildImage(host Host, tag, context string) error

BuildImage builds a Docker image on the given host

func Launch

func Launch(host Host, s *Service) (err error)

Launch creates a Docker container with the service configuration

Types

type Host

type Host interface {
	SetStdin(io.Reader)
	SetStdout(io.Writer)
	SetStderr(io.Writer)
	Exec(...string) error
}

Host represents a docker host where commands can be ran, this can be local or remote server

type LocalHost

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

func Local

func Local() *LocalHost

func (*LocalHost) BuildImage

func (l *LocalHost) BuildImage(tag, context string) error

BuildImage builds a Docker image on the local platform

func (*LocalHost) Exec

func (l *LocalHost) Exec(args ...string) (err error)

func (*LocalHost) Launch

func (l *LocalHost) Launch(service *Service) error

func (*LocalHost) Service

func (l *LocalHost) Service(name string) *Service

func (*LocalHost) Services

func (l *LocalHost) Services() ([]*Service, error)

func (*LocalHost) SetStderr

func (l *LocalHost) SetStderr(stderr io.Writer)

func (*LocalHost) SetStdin

func (l *LocalHost) SetStdin(stdin io.Reader)

func (*LocalHost) SetStdout

func (l *LocalHost) SetStdout(stdout io.Writer)

type RemoteHost

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

func Remote

func Remote(s hosting.Server) *RemoteHost

func (*RemoteHost) BuildImage

func (r *RemoteHost) BuildImage(tag, context string) error

BuildImage builds a Docker image on the remote platform

func (*RemoteHost) Exec

func (r *RemoteHost) Exec(args ...string) (err error)

func (*RemoteHost) Launch

func (r *RemoteHost) Launch(service *Service) error

func (*RemoteHost) Service

func (r *RemoteHost) Service(name string) *Service

func (*RemoteHost) Services

func (r *RemoteHost) Services() ([]*Service, error)

func (*RemoteHost) SetStderr

func (r *RemoteHost) SetStderr(stderr io.Writer)

func (*RemoteHost) SetStdin

func (r *RemoteHost) SetStdin(stdin io.Reader)

func (*RemoteHost) SetStdout

func (r *RemoteHost) SetStdout(stdout io.Writer)

type Service

type Service struct {
	Host

	ID            string
	Status        string
	Name          string
	Image         string
	Network       string
	Privileged    bool
	Entrypoint    string
	Command       string
	RestartPolicy string // e.g., "always", "unless-stopped", "on-failure"
	Ports         map[int]int
	Mounts        map[string]string
	Copied        map[string]string
	Env           map[string]string
}

Service represents a docker container instance existing on a given Platform

func GetService

func GetService(host Host, name string) (*Service, error)

GetService returns a specific service by name from the host

func ListServices

func ListServices(host Host) (services []*Service, err error)

ListServices returns a list of all services on the given host or an error on failure

func (*Service) Copy

func (s *Service) Copy(srcPath, destPath string) error

Copy copies a file from the host to the running container

func (*Service) IsRunning

func (s *Service) IsRunning() bool

IsRunning checks if the service is currently running

func (*Service) Proxy

func (s *Service) Proxy(port int) http.Handler

func (*Service) Remove

func (s *Service) Remove() error

func (*Service) Start

func (s *Service) Start() error

Start starts an existing Docker container

func (*Service) Stop

func (s *Service) Stop() error

Stop stops and removes the Docker container

Jump to

Keyboard shortcuts

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