package runsccmd
import "gvisor.dev/gvisor/pkg/shim/v1/runsccmd"
Package runsccmd provides an API to interact with runsc command line.
Index ¶
- Constants
- func EmittedPaths(id string, config map[string]string) []string
- func FormatRunscPaths(id string, config map[string]string)
- func FormatShimLogPath(path string, id string) string
- type CreateOpts
- type DeleteOpts
- type ExecOpts
- type KillOpts
- type LogMonitor
- func (l *LogMonitor) Start(cmd *exec.Cmd) (chan runc.Exit, error)
- func (l *LogMonitor) Wait(cmd *exec.Cmd, ch chan runc.Exit) (int, error)
- type ProcessMonitor
- type RestoreOpts
- type Runsc
- func (r *Runsc) Create(context context.Context, id, bundle string, opts *CreateOpts) error
- func (r *Runsc) Delete(context context.Context, id string, opts *DeleteOpts) error
- func (r *Runsc) Events(context context.Context, id string, interval time.Duration) (chan *runc.Event, error)
- func (r *Runsc) Exec(context context.Context, id string, spec specs.Process, opts *ExecOpts) error
- func (r *Runsc) Kill(context context.Context, id string, sig int, opts *KillOpts) error
- func (r *Runsc) List(context context.Context) ([]*runc.Container, error)
- func (r *Runsc) Pause(context context.Context, id string) error
- func (r *Runsc) Ps(context context.Context, id string) ([]int, error)
- func (r *Runsc) Restore(context context.Context, id string, cio runc.IO, opts *RestoreOpts) error
- func (r *Runsc) Resume(context context.Context, id string) error
- func (r *Runsc) Run(context context.Context, id, bundle string, opts *CreateOpts) (int, error)
- func (r *Runsc) Start(context context.Context, id string, cio runc.IO) error
- func (r *Runsc) State(context context.Context, id string) (*runc.Container, error)
- func (r *Runsc) Stats(context context.Context, id string) (*runc.Stats, error)
- func (r *Runsc) Top(context context.Context, id string) (*runc.TopResults, error)
- func (r *Runsc) Wait(context context.Context, id string) (int, error)
Constants ¶
const DefaultCommand = "runsc"
DefaultCommand is the default command for Runsc.
Functions ¶
func EmittedPaths ¶
EmittedPaths returns a list of file paths that the sandbox may need to create using the given configuration. Useful to create parent directories.
func FormatRunscPaths ¶
FormatRunscPaths fills in %ID% in path-like flags.
func FormatShimLogPath ¶
FormatShimLogPath creates the file path to the log file. It replaces %ID% in the path with the provided "id". It also uses a default log name if the path ends with '/'.
Types ¶
type CreateOpts ¶
type CreateOpts struct { runc.IO ConsoleSocket runc.ConsoleSocket // PidFile is a path to where a pid file should be created. PidFile string // UserLog is a path to where runsc user log should be generated. UserLog string }
CreateOpts is a set of options to Runsc.Create().
type DeleteOpts ¶
type DeleteOpts struct { Force bool }
DeleteOpts is a set of options to runsc.Delete().
type ExecOpts ¶
type ExecOpts struct { runc.IO PidFile string InternalPidFile string ConsoleSocket runc.ConsoleSocket Detach bool }
ExecOpts is a set of options to runsc.Exec().
type KillOpts ¶
KillOpts specifies options for killing a container and its processes.
type LogMonitor ¶
type LogMonitor struct { Next ProcessMonitor }
LogMonitor implements the runc.ProcessMonitor interface, logging the command that is getting executed, and then forwarding the call to another implementation.
func (*LogMonitor) Start ¶
Start implements runc.ProcessMonitor.
func (*LogMonitor) Wait ¶
Wait implements runc.ProcessMonitor.
type ProcessMonitor ¶
type ProcessMonitor interface { Start(cmd *exec.Cmd) (chan runc.Exit, error) Wait(cmd *exec.Cmd, ch chan runc.Exit) (int, error) }
ProcessMonitor is a subset of runc.ProcessMonitor. It does not include StartLocked(), which was added in containerd/runc v1.1.1. This is so that we can continue using containerd/containerd v1.4.13 with newer containerd/runc versions without breaking build.
var Monitor ProcessMonitor = &LogMonitor{Next: runc.Monitor}
Monitor is the default process monitor to be used by runsc.
type RestoreOpts ¶
RestoreOpts is a set of options to runsc.Restore().
type Runsc ¶
type Runsc struct { Command string PdeathSignal unix.Signal Setpgid bool Root string Log string LogFormat runc.Format PanicLog string Config map[string]string }
Runsc is the client to the runsc cli.
func (*Runsc) Create ¶
Create creates a new container and returns its pid if it was created successfully.
func (*Runsc) Delete ¶
Delete deletes the container.
func (*Runsc) Events ¶
func (r *Runsc) Events(context context.Context, id string, interval time.Duration) (chan *runc.Event, error)
Events returns an event stream from runsc for a container with stats and OOM notifications.
func (*Runsc) Exec ¶
Exec executes an additional process inside the container based on a full OCI Process specification.
func (*Runsc) Kill ¶
Kill sends the specified signal to the container.
func (*Runsc) List ¶
List returns all containers created inside the provided runsc root directory.
func (*Runsc) Pause ¶
Pause will pause a running container.
func (*Runsc) Ps ¶
Ps lists all the processes inside the container returning their pids.
func (*Runsc) Restore ¶
Restore will restore an already created container.
func (*Runsc) Resume ¶
Resume will resume a paused container.
func (*Runsc) Run ¶
Run runs the create, start, delete lifecycle of the container and returns its exit status after it has exited.
func (*Runsc) Start ¶
Start will start an already created container.
func (*Runsc) State ¶
State returns the state for the container provided by id.
func (*Runsc) Stats ¶
Stats return the stats for a container like cpu, memory, and I/O.
func (*Runsc) Top ¶
Top lists all the processes inside the container returning the full ps data.
func (*Runsc) Wait ¶
Wait will wait for a running container, and return its exit status.
Source Files ¶
runsc.go utils.go
- Version
- v0.0.0-20250515200445-d30c58e5b8a4 (latest)
- Published
- May 15, 2025
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 9 hours ago –
Tools for package owners.