code wiki / (root) / nx_container.nx

nx_container.nx

buildroot/runtime/nx_container.nx

7059 B202 linesdepth 3pulls 3 transitivereach 4 importersview sourcekind librarytopic container
docsdependenciesstructsconstsfunctions

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

nx_syscalls_x86_64.nx nx_container.nx nx_container_image_test.nx nx_container_rootless_test.nx nx_container_run_test.nx nx_daemon_container.nx

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

47struct ContainerSpec
64struct ContainerResult

consts

36const NX_CTR_VERDICT_UNKNOWN: i64 = 0
37const NX_CTR_VERDICT_STARTED: i64 = 1
38const NX_CTR_VERDICT_EXITED_OK: i64 = 2
39const NX_CTR_VERDICT_EXITED_ERROR: i64 = 3
40const NX_CTR_VERDICT_BLOCKED_PRIV: i64 = 4 // need CAP_SYS_ADMIN
41const NX_CTR_VERDICT_BLOCKED_FS: i64 = 5 // rootfs missing / unreadable
42const NX_CTR_VERDICT_BLOCKED_EXEC: i64 = 6 // entrypoint not found
43const NX_CTR_VERDICT_N: i64 = 7

functions

72func _bcopy(dst: *u8, src: *u8, n: i64) -> i64
79func _str_proc(out: *u8) -> i64
84func _str_sysfs(out: *u8) -> i64
89func _path_proc_abs(out: *u8) -> i64
94func _path_sys_abs(out: *u8) -> i64
99func _str_none(out: *u8) -> i64
106func _join_path(
122func _child_setup_and_exec(spec: *ContainerSpec) -> i64
160func nx_container_run(spec: *ContainerSpec, out: *ContainerResult) -> i64
198func nx_container_verdict_is_valid(v: i64) -> i64