dockerless

package
v0.0.1-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFileDigest

func CheckFileDigest(path string, digest string) bool

CheckFileDigest will compare input digest to the checksum of input file. Returns whether the input digest is equal to the input file's one.

func Exist

func Exist(path string) bool

Exist returns if a path exists or not.

func GetFileDigest

func GetFileDigest(path string) string

GetFileDigest will return the sha256sum of input file. Empty if error occurs.

func GetPid

func GetPid(id string) (int, error)

GetPid will return the pid of the process running the container with input id.

func Mount

func Mount(src, dest string, mode uintptr) error

Mount will bind-mount src to dest, using input mode.

func MountBind

func MountBind(src, dest string) error

MountBind will bind-mount src path in dest path. Said mount will be created with mode: rbind,rprivate.

func MountDevPts

func MountDevPts(dest string) error

MountDevPts will mount a new devpts in dest path. Said mount will be created with mode: noexec,nosuid,newinstance,ptmxmode=0666,mode=0620.

func MountMqueue

func MountMqueue(dest string) error

MountMqueue will mount a new mqueue tmpfs in dest path. Said mount will be created with mode: noexec,nosuid,nodev.

func MountProc

func MountProc(dest string) error

MountProc will mount a new procfs in dest path. Said mount will be created with mode: noexec,nosuid,nodev.

func MountShm

func MountShm(dest string) error

MountShm will mount a new shm tmpfs to dest path. Said mount will be created with mode: noexec,nosuid,nodev,mode=1777,size=65536k.

func MountTmpfs

func MountTmpfs(dest string) error

MountTmpfs will mount a new tmpfs in dest path.

func PivotRoot

func PivotRoot(path string) error

PivotRoot will perform pivot root syscall into path.

func UntarFile

func UntarFile(workspaceId, path, target string) error

UntarFile will untar target file to target directory. If userns is specified and it is keep-id, it will perform the untarring in a new user namespace with user id maps set, in order to prevent permission errors.

Types

type DockerlessProvider

type DockerlessProvider struct {
	Config *options.Options
	Log    log.Logger
}

func NewProvider

func NewProvider(ctx context.Context, options *options.Options, logs log.Logger) (*DockerlessProvider, error)

func (*DockerlessProvider) Create

func (p *DockerlessProvider) Create(ctx context.Context, workspaceId string, runOptions *driver.RunOptions) error

CreateRootfs will generate a chrootable rootfs from input oci image reference, with input name and config. If input image is not found it will be automatically pulled. This function will read the oci-image manifest and properly unpack the layers in the right order to generate a valid rootfs. Untarring process will follow the keep-id option if specified in order to ensure no permission problems. Generated config will be saved inside the container's dir. This will NOT be an oci-compatible container config.

func (*DockerlessProvider) Delete

func (p *DockerlessProvider) Delete(ctx context.Context, workspaceId string) error

func (*DockerlessProvider) Enter

func (p *DockerlessProvider) Enter(ctx context.Context, workspaceId string) error

func (*DockerlessProvider) ExecuteCommand

func (p *DockerlessProvider) ExecuteCommand(ctx context.Context, workspaceId, user, command string, stdin io.Reader, stdout, stderr io.Writer) error

func (*DockerlessProvider) Find

func (p *DockerlessProvider) Find(ctx context.Context, workspaceId string) (*config.ContainerDetails, error)

func (*DockerlessProvider) Pull

func (p *DockerlessProvider) Pull(ctx context.Context, runOptions *driver.RunOptions) error

Pull will pull a given image and save it to ImageDir. This function uses github.com/google/go-containerregistry/pkg/crane to pull the image's manifest, and performs the downloading of each layer separately. Each layer is deduplicated between images in order to save space, using hardlinks.

func (*DockerlessProvider) Start

func (p *DockerlessProvider) Start(ctx context.Context, workspaceId string) error

func (*DockerlessProvider) Stop

func (p *DockerlessProvider) Stop(ctx context.Context, workspaceId string) error

Jump to

Keyboard shortcuts

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