container

package
v0.0.0-...-49ad519 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDockerClient

func GetDockerClient(ctx context.Context) (*client.Client, error)

func ImageExistsLocally

func ImageExistsLocally(ctx context.Context, imageName string, platform string) (bool, error)

ImageExistsLocally returns a boolean indicating if an image with the requested name, tag and architecture exists in the local docker image store

func LoadDockerAuthConfig

func LoadDockerAuthConfig(image string) (types.AuthConfig, error)

func NewDockerBuildExecutor

func NewDockerBuildExecutor(input NewDockerBuildExecutorInput) common.Executor

NewDockerBuildExecutor function to create a run executor for the container

func NewDockerPullExecutor

func NewDockerPullExecutor(input NewDockerPullExecutorInput) common.Executor

NewDockerPullExecutor function to create a run executor for the container

func NewDockerVolumeRemoveExecutor

func NewDockerVolumeRemoveExecutor(volume string, force bool) common.Executor

func RemoveImage

func RemoveImage(ctx context.Context, imageName string, force bool, pruneChildren bool) (bool, error)

RemoveImage removes image from local store, the function is used to run different container image architectures

func SetContainerAllocateTerminal

func SetContainerAllocateTerminal(val bool)

Types

type Container

type Container interface {
	Create(capAdd []string, capDrop []string) common.Executor
	Copy(destPath string, files ...*FileEntry) common.Executor
	CopyDir(destPath string, srcPath string, useGitIgnore bool) common.Executor
	GetContainerArchive(ctx context.Context, srcPath string) (io.ReadCloser, error)
	Pull(forcePull bool) common.Executor
	Start(attach bool) common.Executor
	Exec(command []string, cmdline string, env map[string]string, user, workdir string) common.Executor
	UpdateFromEnv(srcPath string, env *map[string]string) common.Executor
	UpdateFromImageEnv(env *map[string]string) common.Executor
	UpdateFromPath(env *map[string]string) common.Executor
	Remove() common.Executor
	Close() common.Executor
}

Container for managing docker run containers

func NewContainer

func NewContainer(input *NewContainerInput) Container

NewContainer creates a reference to a container

type FileEntry

type FileEntry struct {
	Name string
	Mode int64
	Body string
}

FileEntry is a file to copy to a container

type HostExecutor

type HostExecutor struct {
	Path    string
	CleanUp func()
	StdOut  io.Writer
}

func (*HostExecutor) Close

func (e *HostExecutor) Close() common.Executor

func (*HostExecutor) Copy

func (e *HostExecutor) Copy(destPath string, files ...*FileEntry) common.Executor

func (*HostExecutor) CopyDir

func (e *HostExecutor) CopyDir(destPath string, srcPath string, useGitIgnore bool) common.Executor

func (*HostExecutor) Create

func (e *HostExecutor) Create(capAdd []string, capDrop []string) common.Executor

func (*HostExecutor) Exec

func (e *HostExecutor) Exec(command []string, cmdline string, env map[string]string, user, workdir string) common.Executor

func (*HostExecutor) GetContainerArchive

func (e *HostExecutor) GetContainerArchive(ctx context.Context, srcPath string) (rc io.ReadCloser, err error)

func (*HostExecutor) Pull

func (e *HostExecutor) Pull(forcePull bool) common.Executor

func (*HostExecutor) Remove

func (e *HostExecutor) Remove() common.Executor

func (*HostExecutor) Start

func (e *HostExecutor) Start(attach bool) common.Executor

func (*HostExecutor) UpdateFromEnv

func (e *HostExecutor) UpdateFromEnv(srcPath string, env *map[string]string) common.Executor

func (*HostExecutor) UpdateFromImageEnv

func (e *HostExecutor) UpdateFromImageEnv(env *map[string]string) common.Executor

func (*HostExecutor) UpdateFromPath

func (e *HostExecutor) UpdateFromPath(env *map[string]string) common.Executor

type NewContainerInput

type NewContainerInput struct {
	Image       string
	Username    string
	Password    string
	Entrypoint  []string
	Cmd         []string
	WorkingDir  string
	Env         []string
	Binds       []string
	Mounts      map[string]string
	Name        string
	Stdout      io.Writer
	Stderr      io.Writer
	NetworkMode string
	Privileged  bool
	UsernsMode  string
	Platform    string
	Hostname    string
}

NewContainerInput the input for the New function

type NewDockerBuildExecutorInput

type NewDockerBuildExecutorInput struct {
	ContextDir string
	Container  Container
	ImageTag   string
	Platform   string
}

NewDockerBuildExecutorInput the input for the NewDockerBuildExecutor function

type NewDockerPullExecutorInput

type NewDockerPullExecutorInput struct {
	Image     string
	ForcePull bool
	Platform  string
	Username  string
	Password  string
}

NewDockerPullExecutorInput the input for the NewDockerPullExecutor function

Jump to

Keyboard shortcuts

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