Documentation ¶
Overview ¶
Package oci implements a Launcher that will configure and launch a container with an OCI runtime. It also provides implementations of OCI state transitions that can be called directly, Create/Start/Kill etc.
Package oci implements a Launcher that will configure and launch a container with an OCI runtime. It also provides implementations of OCI state transitions that can be called directly, Create/Start/Kill etc.
Index ¶
- Constants
- Variables
- func Attach(_ context.Context, containerID string) error
- func Create(containerID, bundlePath string, systemdCgroups bool) error
- func CrunNestCgroup() error
- func Delete(_ context.Context, containerID string, systemdCgroups bool) error
- func Exec(containerID string, cmdArgs []string, systemdCgroups bool) error
- func Kill(containerID string, killSignal string) error
- func Pause(containerID string, systemdCgroups bool) error
- func Resume(containerID string, systemdCgroups bool) error
- func Run(_ context.Context, containerID, bundlePath, pidFile string, ...) error
- func Start(containerID string, systemdCgroups bool) error
- func State(containerID string, systemdCgroups bool) error
- func Update(containerID, cgFile string, systemdCgroups bool) error
- func WrapWithOverlays(f func() error, bundleDir string, overlayPaths []string, allowSetuid bool) error
- func WrapWithWritableTmpFs(f func() error, bundleDir string, allowSetuid bool) error
- type Launcher
Constants ¶
const ( AttachPipeStdin = 1 AttachPipeStdout = 2 AttachPipeStderr = 3 )
Sync with stdpipe_t in conmon.c
Variables ¶
var ( ErrUnsupportedOption = errors.New("not supported by OCI launcher") ErrNotImplemented = errors.New("not implemented by OCI launcher") )
var ErrDetach = errors.New("detached from container")
Functions ¶
func Attach ¶
Attach attaches the console to a running container
FIXME: use context for cancellation, or remove.
func CrunNestCgroup ¶
func CrunNestCgroup() error
crunNestCgroup will check whether we are using crun, and enter a cgroup if running as a non-root user under cgroups v2, with systemd. This is required to satisfy a common user-owned ancestor cgroup requirement on e.g. bare ssh logins. See: https://github.com/sylabs/singularity/issues/1538
func Run ¶
Run runs a container (equivalent to create/start/delete)
FIXME: use context for cancellation, or remove.
func WrapWithOverlays ¶
func WrapWithOverlays(f func() error, bundleDir string, overlayPaths []string, allowSetuid bool) error
WrapWithOverlays runs a function wrapped with prep / cleanup steps for overlays.
func WrapWithWritableTmpFs ¶
WrapWithWritableTmpFs runs a function wrapped with prep / cleanup steps for a tmpfs. This tmpfs is always writable so that the launcher and runtime are able to add content to the container. Whether it is writable from inside the container is controlled by the runtime config.
Types ¶
type Launcher ¶
type Launcher struct {
// contains filtered or unexported fields
}
Launcher will holds configuration for, and will launch a container using an OCI runtime.
func NewLauncher ¶
NewLauncher returns a oci.Launcher with an initial configuration set by opts.