container

package
v0.13.3-rc.8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package container provides utilities for interacting with containers.

Index

Constants

View Source
const (
	DefaultTimeout = 2 * time.Minute
)

Variables

View Source
var (
	ErrCreatingDockerClient           = &Error{Code: "CreatingDockerClient", Message: "failed to create docker client"}
	ErrFailedToCreateContextDir       = &Error{Code: "FailedToCreateContextDir", Message: "failed to create context directory"}
	ErrNoImageNameProvided            = &Error{Code: "NoImageNameProvided", Message: "no image name provided, push before reading"}
	ErrFailedToCreateContainer        = &Error{Code: "FailedToCreateContainer", Message: "failed to create container"}
	ErrFailedToStopContainer          = &Error{Code: "FailedToStopContainer", Message: "failed to stop container"}
	ErrFailedToRemoveContainer        = &Error{Code: "FailedToRemoveContainer", Message: "failed to remove container"}
	ErrFailedToStartContainer         = &Error{Code: "FailedToStartContainer", Message: "failed to start container"}
	ErrFailedToCopyFileFromContainer  = &Error{Code: "FailedToCopyFileFromContainer", Message: "failed to copy file from container"}
	ErrFailedToReadFromTar            = &Error{Code: "FailedToReadFromTar", Message: "failed to read from tar"}
	ErrFailedToReadFileFromTar        = &Error{Code: "FailedToReadFileFromTar", Message: "failed to read file from tar"}
	ErrFileNotFoundInTar              = &Error{Code: "FileNotFoundInTar", Message: "file not found in tar"}
	ErrFailedToWriteDockerfile        = &Error{Code: "FailedToWriteDockerfile", Message: "failed to write Dockerfile"}
	ErrFailedToGetBuildContext        = &Error{Code: "FailedToGetBuildContext", Message: "failed to get build context"}
	ErrFailedToGetDefaultCacheOptions = &Error{Code: "FailedToGetDefaultCacheOptions", Message: "failed to get default cache options"}
	ErrHashingDockerfile              = &Error{Code: "HashingDockerfile", Message: "error hashing Dockerfile content"}
	ErrReadingFile                    = &Error{Code: "ReadingFile", Message: "error reading file: %s"}
	ErrHashingFile                    = &Error{Code: "HashingFile", Message: "error hashing file %s"}
	ErrHashingBuildContext            = &Error{Code: "HashingBuildContext", Message: "error hashing build context"}
)

Functions

This section is empty.

Types

type BuilderFactory added in v0.3.0

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

BuilderFactory is responsible for creating new instances of buildah.Builder

func NewBuilderFactory added in v0.3.0

func NewBuilderFactory(imageName, buildContext string, imageBuilder builder.Builder) (*BuilderFactory, error)

NewBuilderFactory creates a new instance of BuilderFactory.

func (*BuilderFactory) AddToBuilder added in v0.7.0

func (f *BuilderFactory) AddToBuilder(srcPath, destPath, chown string) error

AddToBuilder adds a file from the source path to the destination path in the image, with the specified ownership.

func (*BuilderFactory) BuildImageFromGitRepo added in v0.11.0

func (f *BuilderFactory) BuildImageFromGitRepo(ctx context.Context, gitCtx builder.GitContext, imageName string) error

BuildImageFromGitRepo builds an image from the given git repository and pushes it to a registry. The image is identified by the provided name.

func (*BuilderFactory) Changed added in v0.7.0

func (f *BuilderFactory) Changed() bool

Changed returns true if the builder has been modified, false otherwise.

func (*BuilderFactory) ExecuteCmdInBuilder added in v0.3.0

func (f *BuilderFactory) ExecuteCmdInBuilder(command []string) (string, error)

ExecuteCmdInBuilder runs the provided command in the context of the given builder. It returns the command's output or any error encountered.

func (*BuilderFactory) GenerateImageHash added in v0.13.1

func (f *BuilderFactory) GenerateImageHash() (string, error)

GenerateImageHash creates a hash value based on the contents of the Dockerfile instructions and all files in the build context.

func (*BuilderFactory) ImageNameFrom added in v0.7.0

func (f *BuilderFactory) ImageNameFrom() string

ImageNameFrom returns the name of the image from which the builder is created.

func (*BuilderFactory) PushBuilderImage added in v0.3.0

func (f *BuilderFactory) PushBuilderImage(imageName string) error

PushBuilderImage pushes the image from the given builder to a registry. The image is identified by the provided name.

func (*BuilderFactory) ReadFileFromBuilder added in v0.3.0

func (f *BuilderFactory) ReadFileFromBuilder(filePath string) ([]byte, error)

ReadFileFromBuilder reads a file from the given builder's mount point. It returns the file's content or any error encountered.

func (*BuilderFactory) SetEnvVar added in v0.3.0

func (f *BuilderFactory) SetEnvVar(name, value string) error

SetEnvVar sets the value of an environment variable in the builder.

func (*BuilderFactory) SetUser added in v0.7.0

func (f *BuilderFactory) SetUser(user string) error

SetUser sets the user in the builder.

type Error added in v0.13.3

type Error struct {
	Code    string
	Message string
	Err     error
	Params  []interface{}
}

func (*Error) Error added in v0.13.3

func (e *Error) Error() string

func (*Error) WithParams added in v0.13.3

func (e *Error) WithParams(params ...interface{}) *Error

func (*Error) Wrap added in v0.13.3

func (e *Error) Wrap(err error) error

Jump to

Keyboard shortcuts

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