cli

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDockerHost = "unix:///var/run/box.sock"

DefaultDockerHost is the unix socket box serves the Docker-compatible API on by default. Point a Docker client (or Gitea's act_runner) at it with DOCKER_HOST=unix:///var/run/box.sock.

Variables

View Source
var ErrNotPermitted = errors.New("operation not permitted")

Functions

func Main

func Main(w io.Writer, args []string) error

Main is the entrypoint used by the actual main program, and by integration tests that drive the CLI in-process. It runs the command with the given args (which include the program name at args[0], as in os.Args) and directs the command's output to w.

func NewAgentCommand

func NewAgentCommand() *cobra.Command

NewAgentCommand implements and returns the hidden agent command: the in-VM service that runs commands forwarded from a box client on macOS.

func NewApplyCommand added in v0.4.0

func NewApplyCommand() *cobra.Command

NewApplyCommand implements and returns the apply command.

func NewBootCommand added in v0.1.3

func NewBootCommand() *cobra.Command

NewBootCommand implements and returns the boot command.

func NewBoxCommand

func NewBoxCommand() *cobra.Command

NewBoxCommand returns the root cobra.Command for box.

func NewBuildCommand

func NewBuildCommand() *cobra.Command

NewBuildCommand implements and returns the build command.

func NewCpCommand

func NewCpCommand() *cobra.Command

NewCpCommand implements and returns the cp command.

func NewDiffCommand added in v0.4.0

func NewDiffCommand() *cobra.Command

NewDiffCommand implements and returns the diff command.

func NewDockerdCommand

func NewDockerdCommand() *cobra.Command

NewDockerdCommand returns the `box dockerd` command: a long-lived process that serves a Docker Engine API-compatible socket backed by box, so tools that speak to a Docker daemon (e.g. Gitea act_runner) can drive box instead.

func NewDoctorCommand

func NewDoctorCommand() *cobra.Command

NewDoctorCommand implements and returns the version command.

func NewExecCommand

func NewExecCommand() *cobra.Command

NewExecCommand implements and returns the exec command.

func NewExecInitCommand

func NewExecInitCommand() *cobra.Command

NewExecInitCommand implements the hidden exec-init command. It is re-exec'd by `box exec` to run a command inside the container's joined namespaces (plus a fresh mount namespace); its configuration is passed through the environment (box.exec*), and the command argv as positional arguments.

func NewExplainCommand added in v0.2.2

func NewExplainCommand() *cobra.Command

NewExplainCommand implements and returns the explain command.

func NewImagesCommand

func NewImagesCommand() *cobra.Command

NewImagesCommand implements and returns the images command.

func NewInitCommand

func NewInitCommand() *cobra.Command

NewInitCommand implements and returns init command. init command is called by reexec to apply namespaces.

It is a hidden command and requires root path and container id to run.

func NewInspectCommand

func NewInspectCommand() *cobra.Command

NewInspectCommand implements and returns the inspect command.

func NewKillCommand

func NewKillCommand() *cobra.Command

NewKillCommand implements and returns the kill command.

func NewLogsCommand

func NewLogsCommand() *cobra.Command

NewLogsCommand implements and returns the logs command.

func NewPruneCommand

func NewPruneCommand() *cobra.Command

NewPruneCommand implements and returns the prune command.

func NewPsCommand

func NewPsCommand() *cobra.Command

NewPsCommand implements and returns the ps command.

func NewPullCommand

func NewPullCommand() *cobra.Command

NewPullCommand implements and returns the pull command.

func NewRmCommand

func NewRmCommand() *cobra.Command

NewRmCommand implements and returns the rm command.

func NewRmiCommand

func NewRmiCommand() *cobra.Command

NewRmiCommand implements and returns the rmi command.

func NewRunCommand

func NewRunCommand() *cobra.Command

NewRunCommand implements and returns the run command.

func NewSandboxCommand added in v0.1.0

func NewSandboxCommand() *cobra.Command

NewSandboxCommand implements the hidden sandbox command. It is re-exec'd by init (and by exec-init) as the last stage before the container command: it reduces the process's privileges — no_new_privs, the capability sets, the user switch — and then execve's the command. Its configuration arrives through the environment (box.sandbox*), the command argv as positional arguments.

It is a separate stage because the reduction has to be done by the process that execs, and Go cannot run code between fork and exec.

func NewStatsCommand

func NewStatsCommand() *cobra.Command

NewStatsCommand implements and returns the stats command.

func NewStopCommand

func NewStopCommand() *cobra.Command

NewStopCommand implements and returns the stop command.

func NewUsernsHoldCommand added in v0.1.0

func NewUsernsHoldCommand() *cobra.Command

NewUsernsHoldCommand implements the hidden userns-hold command. It is re-exec'd into a fresh user namespace purely so its parent can open /proc//ns/user and hold that namespace open; it waits on stdin and is killed the moment the descriptor is in hand. See the userns package.

func NewVersionCommand

func NewVersionCommand() *cobra.Command

NewVersionCommand implements and returns the version command.

func Run

func Run() int

Run runs the Main entrypoint and returns the process exit code: the container command's own status for a run/exec that ended non-zero, 1 for any other error, 0 on success. This is mostly useful to faciliate e2e integration testing of the CLI. It passes `os.Stdout` as the output `io.Writer` and `os.Args[:]` as the args passed to `Main`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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