📦 A command-line utility (non-daemon) for creating Linux containers, sandboxing a processes written in Go.
- Control Groups for resource restriction (CPU, Memory, Swap, PIDs)
- Namespace for global system resources isolation (Mount, UTS, Network, IPS, PID)
- Union File System for branches to be overlaid in a single coherent file system. (OverlayFS)
- Isolated Networking each container get its own networking and ip address automatically (IPAM)
If you have a Go development environment setup with
$GOPATH/bin/ in your
the following will just work™ 😀
go get -u github.com/prologic/box
Otherwise you can build from source using
git (You still need the Go compiler):
git clone https://github.com/prologic/box.git cd box make
There are pre-built binaries I publish regularly to the Releases page you can download and install. Example:
wget https://github.com/prologic/box/releases/download/0.0.4/box_0.0.4_linux_amd64.tar.gz tar xvf box_0.0.4_linux_amd64.tar.gz
box requires elevated privileges in order to create new namespaces and
control groups, it must be run as
root or with an effective uid of
You can either run
box as root, or you can install the binary with the suid
chmod u+s box
# box --help A tiny tool for managing containers and sandbox processes Usage: box [command] Available Commands: exec Run a command inside a existing Container. help Help about any command images List local images ps List Containers pull Pulls an OCI compatible image from a registry rm Removes a Container. run Run a command inside a new Container. stop Stops a Container. version Display the version of box and exit Flags: -D, --debug Enable debug logging -h, --help help for box Use "box [command] --help" for more information about a command.
box run alpine /bin/sh box run alpine # same as above due to alpine default command
/bin/ch -c 'echo "Hwllo World"':
box run alpine -- /bin/sh -c 'echo "Hello World"'
-- is important here as this acts as the "flag terminator" for
box CLI and the
run sub-command and allows you to then use
command-line options that are passed to your images' entrypoint.
IP Address Management (IPAM)
box has a builtin IPAM (IP Address Management) that has a hard
coded subnet of
box0 bridge (switch) is setup for all
containers (automatically) and containers are put into their own isolated
Network Namespace and assigned an IP Address out of this subnet automatically
(without requiring DHCP).
Currently there is no support for using a different subnet or assigning static IP Addresses to containers at this time.
External Networking and Port Mapping
box requires and depends on the
iptables binary to manipulate
NAT rules to allow containers access to external networks (MASQUERADE)
and mapping ports from the host to the container (DNAT).
box injects the host's
/etc/resolv.conf into a newly formed container so
as long as DNS Resolution works on your host, it will work inside containers too.
box is/does NOT:
- Designed to be used in critical production workloads.
- Known to have any orchestrator(s) for managing services.
- Useful for multi-host networking and has no support for it.
- Have any support for volumes besides bind-mount(s) from the host
- Have any other features you'd expect from Docker, Docker Swarm or Kubernetes.
box is licensed under the MIT License.
There is no documentation for this package.