box is a command runner that uses a container-first approach to execute commands. It runs on host system as well as inside docker equally well. It is a simple, yet powerful tool that can be used to avoid the hassle of installing heavy or one-off packages and remembering the docker syntax.
It is lightweight (less than 3MB as opposed to docker CLI's 60MB) making it suitable for use in containerized development environments.
box executes commands in an ephemeral container, which is destroyed after the command finishes. Results are streamed to the terminal and generated artifacts are mapped to working directory.
Download and install:
- Docker
- NVIDIA Container Toolkit (Optional - For GPU Support)
Box provides pre-compiled binary releases for Linux.
Simply download the latest release from github and put it on $PATH.
box add -k <key> -i <image> -c <command>
Optional Flags:
-g: Enable GPU support-m: Avoid mounting current directory inside container
box remove -k <key>
Optional Flags:
-i: Keep image
box run <key> <args...>
box ls
box ls remote
box fetch <key>
Optional Flags:
-k: Use alternate key for saving to avoid conflicts
box alias -a <alias> <key> <optional-commands>
Run the following command to fetch docker/whalesay image and add it to box:
box add -k say -i docker/whalesay:latest -c cowsay
After successfully adding the command, you can run it with:
box run say "box rocks!"
It should output:
____________
< box rocks! >
------------
\
\
\
, ## .
, ## ## ## ==
, ## ## ## ## ===
) /""""""""""""""""___/ ===
, ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
* \______ o __/
' \ \ __/
____\______/
Let's say we use this command frequently and want to add an alias for it:
box alias -a say say
Now as long as you are in a directory with proper .box file, you can simply run say to execute the command.
say "box rocks!"
This should still produce the same output.
Download and install the following software
- go toolchain
- upx (Optional - For Compression)
- Clone the repository:
git clone https://github.com/machinelearning-one/box.git- Change directories and run the following command to build the binary:
cd box
go build -ldflags="-s -w"- (Optional) Compress the binary:
upx --brute box-
addnew commands to box -
rmcommands from box -
runcommands from box - Works inside a docker container (socket mounting required)
- GPU support
-
lslocal commands and images -
lsremote commands and images -
fetchfor getting remote commands -
aliasto avoid extra typing - Create a library of common commands - (In progress)
- V2: Use BubbleTea for interactivity
The banner for this repository is a modified version of art by Ashley McNamara released under CC BY-NC-SA 4.0. Thank you Ashley for making such great art available to everyone!
