{"id":32492913,"url":"https://github.com/awcodify/nsctl","last_synced_at":"2026-07-13T11:32:10.678Z","repository":{"id":320401035,"uuid":"1081964964","full_name":"awcodify/nsctl","owner":"awcodify","description":"A minimal educational container runtime. no Docker, no runc, just pure Linux kernel (namespaces \u0026 cgroups)","archived":false,"fork":false,"pushed_at":"2025-10-23T14:42:44.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-23T16:35:58.525Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awcodify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-23T14:40:07.000Z","updated_at":"2025-10-23T14:42:48.000Z","dependencies_parsed_at":"2025-10-23T16:36:00.983Z","dependency_job_id":null,"html_url":"https://github.com/awcodify/nsctl","commit_stats":null,"previous_names":["awcodify/nsctl"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/awcodify/nsctl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fnsctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fnsctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fnsctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fnsctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awcodify","download_url":"https://codeload.github.com/awcodify/nsctl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awcodify%2Fnsctl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35421716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-27T11:58:52.466Z","updated_at":"2026-07-13T11:32:10.672Z","avatar_url":"https://github.com/awcodify.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nsctl - Minimal Container Runtime\n\nA simple educational container runtime implemented in Go using Linux namespaces and cgroups.\n\n## Overview\n\n`nsctl` demonstrates how containers work at the Linux kernel level by using:\n- **UTS namespace** - Isolates hostname\n- **PID namespace** - Isolates process IDs  \n- **Mount namespace** - Isolates filesystem mounts\n\n\n## Usage\n\n**Note: This only works on Linux** - namespaces are a Linux kernel feature.\n\n### Build\n```bash\ngo build -o nsctl ./cmd\n```\n\n### Run Commands\n\n```bash\n# Run a specific command in isolation  \n./nsctl run /bin/bash\n\n# List running containers (not implemented yet)\n./nsctl ps\n```\n\n### Expected Output (Linux)\n```bash\n$ ./nsctl simple\n[ns] creating PID, UTS, and mount namespaces\n[ns] started bash with PID 1234 in isolated namespaces\nroot@container:/# \n```\n\nInside the container:\n- `hostname` shows \"container\" \n- `ps` shows only processes in the isolated PID namespace\n- Process runs as PID 1 in its namespace\n\n## Architecture\n\n```\nnsctl/\n├── cmd/main.go              # CLI entrypoint\n├── pkg/ns/\n│   ├── namespace.go         # Linux implementation (build constraint: linux)\n│   └── namespace_stub.go    # Non-Linux stub (build constraint: !linux)\n├── pkg/cgroup/              # Future: cgroup resource limits\n└── go.mod\n```\n\n## Implementation Details\n\n### Namespace Setup\n- Uses `syscall.SysProcAttr.Cloneflags` with `exec.Command`\n- Creates new UTS, PID, and mount namespaces via clone flags\n- Connects stdin/stdout/stderr to parent process\n\n### Future Enhancements\n1. **Cgroups**: CPU/memory limits via `/sys/fs/cgroup/`\n2. **Process Management**: Track running containers\n3. **Filesystem Isolation**: chroot or overlay filesystems\n4. **Network Namespaces**: Isolated networking\n\n## Educational Goals\n\nThis project helps understand:\n- How containers are just processes with Linux namespaces\n- The syscalls underlying container runtimes like Docker\n- Direct interaction with Linux kernel features\n- Building system-level Go applications\n\n## Limitations\n\n- **Linux only** - uses Linux-specific syscalls\n- **No filesystem isolation** - shares host filesystem  \n- **No resource limits** - no cgroup integration yet\n- **No networking** - uses host network\n- **Educational purpose** - not production ready\n\n## References\n\n- [Linux Namespaces](https://man7.org/linux/man-pages/man7/namespaces.7.html)\n- [Linux Cgroups](https://man7.org/linux/man-pages/man7/cgroups.7.html)\n- [Container Internals](https://jvns.ca/blog/2016/10/10/what-even-is-a-container/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawcodify%2Fnsctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawcodify%2Fnsctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawcodify%2Fnsctl/lists"}