hakoniwa run -v \
--unshare-all \
--rootfs / --devfs /dev --tmpfs /tmp \
-- dd if=/dev/random of=/tmp/output.txt count=1 bs=4hakoniwa run -v- Run a COMMAND in a container. By default, it will
- Create a new
MOUNTnamespace - Create a new
USERnamespace and map current user to itself - Create a new
PIDnamespace and mount a newprocfson/proc - With
-vto show logging output
--unshare-all- Create new
CGROUP,IPC,NETWORK,UTS, ... namespaces
- Create new
--rootfs / --devfs /dev --tmpfs /tmp- Bind mount
/bin,/lib,/etc,/usr, ... with read-only access if exists - Mount
devfson/dev, it contains a minimal set of device files, like/dev/null - Mount
tmpfson/tmp
- Bind mount
-- dd if=/dev/random of=/tmp/output.txt count=1 bs=4- Exec COMMAND
dd if=/dev/random of=/tmp/output.txt count=1 bs=4
- Exec COMMAND
In most cases, you can just use following code (--rootfs=/ is enabled by default):
hakoniwa run --unshare-all --devfs /dev --tmpfs /tmp -- ls -lahFor TUI app, run with -e TERM:
hakoniwa run --unshare-all --devfs /dev --tmpfs /tmp -e TERM -- topFor static linked binaries, it is not necassary to mount system-wide directories, run with --rootfs=none:
hakoniwa run --unshare-all --devfs /dev --tmpfs /tmp --rootfs=none -b /mybin -- /mybin/static-linked-binaries-COMMANDWant to access network, run with --network=pasta:
hakoniwa run --unshare-all --devfs /dev --tmpfs /tmp --network=pasta -- wget https://example.com --spiderWant to restrict process resource usage, run with --limit-xxxx:
hakoniwa run --unshare-all --devfs /dev --tmpfs /tmp --limit-walltime 1 -- sleep 2By default, it always loads a Podman-compatible seccomp profile, want to use a customized profile, run with --seccomp=myprofile.toml:
hakoniwa run --unshare-all --devfs /dev --tmpfs /tmp --seccomp=myprofile.toml -- lsWant to see what features are enabled, use -v or -vv to display the logging output:
hakoniwa run --unshare-all --devfs /dev --tmpfs /tmp -v -- lsIf the command line is too long, too complex, you can create a profile and run with --config:
hakoniwa run -c myprofile.tomlthe COMMAND can be overridden:
hakoniwa run -c myprofile.toml -- another-COMMAND- Unshare Linux Namespace
- Mount FileSystem
- Network
- User
- Process Resource Limit
- Control Groups
- Landlock
- Seccomp Profile
- Misc
- Config
- COMMAND
If you receive hakoniwa: write("/proc/self/uid_map", ...) => Operation not permitted (os error 1), read following docs:
If you experience a DNS lookup failure, read following docs: