nx_container.nx
buildroot/runtime/nx_container.nx
about
nx_container.nx -- sovereign container runtime (Docker replacement).
One process per container. Substrate forks, child:
1. unshare(CLONE_NEWUTS|CLONE_NEWPID|CLONE_NEWNS|CLONE_NEWIPC)
2. mount root filesystem of the container image
3. pivot_root or chroot into it
4. mount /proc, /sys, /dev pseudo-fs inside the new root
5. execve(entrypoint, argv)
Parent waits via sys_wait4 and returns the child's exit code.
What it ISN'T (yet): network namespacing with veth pair, full
cgroupv2 resource accounting, image pull from a registry,
overlayfs union mounts. Those are L8b/c/d in the roadmap; each is
a named improvement queued behind the basic case.
What it IS: a sovereign primitive that is enough to run our own
services (nishi_web, gitea, sshd) inside chrooted PID-namespace
isolation, with CAS-pinned root filesystems. No Docker daemon.
No /var/lib/docker. No vendored Go runtime. No yaml.
Sealed enums per cardinal feedback-honest-perf-verdict.
genealogy_id: linux_namespaces_2002 + lmctfy_2013 + runc_2016 +
oci_runtime_spec_v1 + bocker_jpetazzo_2015
lineage_id: nishi_run_sovereign_q10
dependencies 1 imports · 4 importers
imports: nx_syscalls_x86_64.nx
imported by: nx_container_image_test.nxnx_container_rootless_test.nxnx_container_run_test.nxnx_daemon_container.nx
structs
| 47 | struct ContainerSpec |
| 64 | struct ContainerResult |
consts
| 36 | const NX_CTR_VERDICT_UNKNOWN: i64 = 0 |
| 37 | const NX_CTR_VERDICT_STARTED: i64 = 1 |
| 38 | const NX_CTR_VERDICT_EXITED_OK: i64 = 2 |
| 39 | const NX_CTR_VERDICT_EXITED_ERROR: i64 = 3 |
| 40 | const NX_CTR_VERDICT_BLOCKED_PRIV: i64 = 4 // need CAP_SYS_ADMIN |
| 41 | const NX_CTR_VERDICT_BLOCKED_FS: i64 = 5 // rootfs missing / unreadable |
| 42 | const NX_CTR_VERDICT_BLOCKED_EXEC: i64 = 6 // entrypoint not found |
| 43 | const NX_CTR_VERDICT_N: i64 = 7 |
functions
| 72 | func _bcopy(dst: *u8, src: *u8, n: i64) -> i64 |
| 79 | func _str_proc(out: *u8) -> i64 called by 1: _child_setup_and_exec |
| 84 | func _str_sysfs(out: *u8) -> i64 |
| 89 | func _path_proc_abs(out: *u8) -> i64 called by 1: _child_setup_and_exec |
| 94 | func _path_sys_abs(out: *u8) -> i64 |
| 99 | func _str_none(out: *u8) -> i64 called by 1: _child_setup_and_exec |
| 106 | func _join_path( |
| 122 | func _child_setup_and_exec(spec: *ContainerSpec) -> i64 called by 1: nx_container_run calls 7: sys_unsharesys_chroot_path_proc_abs_str_proc_str_nonesys_mount+1 |
| 160 | func nx_container_run(spec: *ContainerSpec, out: *ContainerResult) -> i64 |
| 198 | func nx_container_verdict_is_valid(v: i64) -> i64 |