rpk ai sandbox shell
Open an interactive shell in a sandbox, or run a command in it.
Without a command, the shell is bash, or sh in an image without bash. With a terminal on both stdin and stdout, the process runs on a pseudo-terminal of your terminal’s size and follows its resizes. Keystrokes go to the process, Ctrl+C and Ctrl+D included. Otherwise stdin and stdout are plain pipes, so the command can sit in a pipeline.
The command exits with the process’s exit status.
The process lives in the sandbox, not in this command. On a terminal, press Ctrl+] then d to leave it running. On pipes those keys are ordinary input, so the first Ctrl+C is sent to the process and a second one leaves it running. Either way, the command prints how to attach to it again. If the connection drops, the output stream is re-attached on its own.
On pipes, nothing else may write to the process’s stdin. Your input is then delivered exactly once, even when the command has to retry a write whose reply was lost. On a terminal, input is appended instead, so an attach can type into the process at the same time. If the reply to a write is lost, the command stops and reports that the input may not have arrived.
Commands are not run through a shell. Pass sh -c … for pipes and
redirections.
Requires Sandbox.create_process, Sandbox.stream_process_output, and
Sandbox.write_process_input on the sandbox. Terminal resizing uses
Sandbox.resize_terminal. Forwarding local signals in pipe mode uses
Sandbox.signal_process. Sandbox.exec is not sufficient.
Examples
This section provides examples of how to use rpk ai sandbox shell.
An interactive shell
rpk ai sandbox shell dev
One command, with the exit status of the command
rpk ai sandbox shell dev -- make test
In a directory, with environment variables
rpk ai sandbox shell dev --cwd /work --env DEBUG=1 -- ./run.sh
In a pipeline
tar c . | rpk ai sandbox shell dev -- tar x -C /work
Flags
| Value | Type | Description |
|---|---|---|
|
string |
Working directory for the process, the sandbox’s default if unset. |
|
stringArray |
Environment variable to set for the process, as KEY=VALUE ( |
Global flags
| Value | Type | Description |
|---|---|---|
|
string |
Redpanda or |
|
stringArray |
Override |
|
bool |
Ignore |
|
string |
|
|
bool |
Enable verbose logging. |