Skip to content

Add CLI tool for standalone usage #35

@DorianZheng

Description

@DorianZheng

Summary

Provide a CLI tool for using BoxLite without writing code, offering a familiar Docker/Podman-like experience.

Motivation

  • Quick testing without writing code
  • Shell scripting and automation
  • Familiar UX for Docker/Podman users
  • Debugging and development
  • Demo and evaluation

Proposed Commands

Run (create + start + exec + rm)

# Run command and exit
boxlite run alpine:latest -- echo "Hello from BoxLite"

# Interactive shell
boxlite run -it python:slim

# With options
boxlite run --cpus 2 --memory 1024 -e FOO=bar alpine:latest -- sh

Box Lifecycle

# Create without starting
boxlite create --name mybox alpine:latest

# Start/stop/restart
boxlite start mybox
boxlite stop mybox
boxlite restart mybox

# Remove
boxlite rm mybox
boxlite rm -f mybox  # force remove running box

Inspect and Monitor

# List boxes
boxlite ls
boxlite ls -a  # include stopped

# Inspect details
boxlite inspect mybox
boxlite inspect --format '{{.State}}' mybox

# Logs
boxlite logs mybox
boxlite logs -f mybox  # follow

# Metrics
boxlite stats mybox

Execute in Running Box

boxlite exec mybox -- python script.py
boxlite exec -it mybox -- /bin/sh

Images

boxlite pull python:slim
boxlite images
boxlite rmi python:slim

System

boxlite info          # Runtime info
boxlite system prune  # Cleanup unused resources

Output Formats

boxlite ls --format json
boxlite ls --format table  # default
boxlite inspect mybox --format yaml

Implementation Notes

  • Use clap for argument parsing
  • Reuse existing BoxliteRuntime
  • Consider boxlite binary name (or bx for short?)
  • Support both sync and async operations

Tasks

  • Design CLI structure with clap
  • Implement run command
  • Implement create/start/stop/rm commands
  • Implement exec command with TTY support
  • Implement ls/inspect/logs commands
  • Implement pull/images commands
  • Add output format options (json, table, yaml)
  • Write documentation
  • Add shell completions (bash, zsh, fish)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions