Documentation ¶
Index ¶
- func AwaitFifoOpen(ctx context.Context, id string) error
- func CleanupEntrypoint(id string) error
- func ConfPath(id string) string
- func CreateConfig(config *Config) (string, error)
- func CreateJail(ctx context.Context, confPath string) error
- func DestroyJail(ctx context.Context, confPath, jail string) error
- func ExecEntrypoint(id string, argv []string, env []string, consoleSocketPath string) error
- func IsRunning(ctx context.Context, jail string, pid int) (bool, error)
- func Kill(ctx context.Context, jail string, pid int, signal unix.Signal) error
- func KillAll(ctx context.Context, jail string, signal unix.Signal) error
- func Mount(ociConfig *runtimespec.Spec) error
- func SetupEntrypoint(id string, init bool, argv []string, env []string, consoleSocketPath string) (*exec.Cmd, error)
- func Unmount(ociConfig *runtimespec.Spec) error
- type Config
- type ID
- type Jail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AwaitFifoOpen ¶
AwaitFifoOpen waits for a runj-entrypoint process to open the fifo passed to it. The fifo is used to indicate when runj-entrypoint should start the process inside the jail.
func CleanupEntrypoint ¶
CleanupEntrypoint sends a SIGTERM to the PID recorded in the state file. This function returns with no error even if the process is not running or cannot be signaled.
func CreateConfig ¶
CreateConfig creates a config file for the jail(8) command
func CreateJail ¶
CreateJail wraps the jail(8) command to create a jail
func DestroyJail ¶
DestroyJail wraps the jail(8) command to destroy a jail
func ExecEntrypoint ¶
ExecEntrypoint execs a runj-entrypoint process in order to start processes inside the jail.
Note: this API is unstable; expect it to change.
func IsRunning ¶
IsRunning attempts to determine whether a given jail is running. This is accomplished by looking to see whether the jail's primary pid (passed as an argument) is still active and by whether there are any processes present in the jail. This function is best-effort, racy, and subject to change. It currently depends on the host's "ps" command.
func SetupEntrypoint ¶
func SetupEntrypoint(id string, init bool, argv []string, env []string, consoleSocketPath string) (*exec.Cmd, error)
SetupEntrypoint starts a runj-entrypoint process, which is used to start processes inside the jail.
When used to start the jail's init process, runj-entrypoint will later be signalled through `runj start` to run the specified program in the jail. This indirection is necessary so that the STDIO for `runj create` or the supplied console socket is directed to that process.
When used to start a secondary process inside the jail, the waiting step is skipped and runj-entrypoint will immediately proceed to create the process as soon as STDIO is configured.
Note: this API is unstable; expect it to change.
func Unmount ¶
func Unmount(ociConfig *runtimespec.Spec) error
Unmount attempts to unmount all mounts present in the spec. If multiple errors occur, Unmount returns the first.
Types ¶
type Config ¶
type Config struct { Name string Root string Hostname string IP4 string IP4Addr []string VNet string VNetInterface []string }
Config is a limited subset of the parameters available in jail.conf(5) for use with jail(8).