{"id":26105761,"url":"https://github.com/ankush-003/gorunner","last_synced_at":"2025-03-09T21:53:55.528Z","repository":{"id":281525836,"uuid":"945344360","full_name":"ankush-003/goRunner","owner":"ankush-003","description":"a linux container runtime written in golang","archived":false,"fork":false,"pushed_at":"2025-03-09T17:22:55.000Z","size":1983,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T18:20:50.370Z","etag":null,"topics":["golang","linux-containers"],"latest_commit_sha":null,"homepage":"","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/ankush-003.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}},"created_at":"2025-03-09T07:33:34.000Z","updated_at":"2025-03-09T17:22:58.000Z","dependencies_parsed_at":"2025-03-09T18:20:52.298Z","dependency_job_id":"bc065acf-4ca3-4295-a976-5d8b96731f6e","html_url":"https://github.com/ankush-003/goRunner","commit_stats":null,"previous_names":["ankush-003/gorunner"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankush-003%2FgoRunner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankush-003%2FgoRunner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankush-003%2FgoRunner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankush-003%2FgoRunner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankush-003","download_url":"https://codeload.github.com/ankush-003/goRunner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242757001,"owners_count":20180204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["golang","linux-containers"],"created_at":"2025-03-09T21:53:54.727Z","updated_at":"2025-03-09T21:53:55.472Z","avatar_url":"https://github.com/ankush-003.png","language":"Go","readme":"# goRunner 🐳\na linux container runtime written in golang\n\n## How to create a child process ?\n\n- `fork()` system call is used to create a new process. It creates a new process by duplicating the calling process. The new process, called the child, is an exact copy of the calling process, called the parent, except for a few values that are different. [Read more](https://cs.brown.edu/courses/csci0300/2022/notes/l17.html)\n- golang uses `os/exec` package to create a child process. [Read more](https://golang.org/pkg/os/exec/)\n- `os/exec` package provides a way to create a child process and execute a command in that process. \n\nSteps Involved in Execution:\n\n1. Create a Command Struct\n   - exec.Command(name string, arg ...string) initializes a command with the given program name and arguments.\n\n2. Start the Process\n   - cmd.Start() spawns a new process but does not wait for it to complete.\n   - The process is run asynchronously.\n\n3. Wait for the Process to Finish\n   - cmd.Wait() waits for the process to complete.\n   - This is needed when using cmd.Start().\n\n4. Get Output\n   - cmd.Output() runs the command and returns its standard output.\n   - cmd.CombinedOutput() returns both stdout and stderr.\n\n## How do we isolate the child process ?\n\n- namespace is a feature of the Linux kernel that partitions kernel resources such that one set of processes sees one set of resources while another set of processes sees a different set of resources.\n- The Linux kernel provides six types of namespaces: \n  - Mount (mnt)\n  - Process ID (pid)\n  - Network (net)\n  - Inter-process communication (ipc)\n  - UTS (uts includes hostname and NIS domain name)\n  - User (user)\n  - cgroup (control group means resource limitation)\n- The `clone()` system call is used to create a new process in a new namespace. [Read more](https://medium.com/@teddyking/namespaces-in-go-basics-e3f0fc1ff69a)\n\n# References 🔗\n\n- [bocker- docker in 100 lines of bash](https://medium.com/@teddyking/namespaces-in-go-basics-e3f0fc1ff69a)\n- [containers from scratch](https://medium.com/@ssttehrani/containers-from-scratch-with-golang-5276576f9909)\n- [Vessel - A simple container runtime](https://medium.com/swlh/build-containers-from-scratch-in-go-part-1-namespaces-c07d2291038b)\n- [Containers from scratch in Go](https://www.youtube.com/watch?v=8fi7uSYlOdc)\n- [Build your own container using less than 100 lines of Go](https://www.infoq.com/articles/build-a-container-golang/)\n- [ns-process - learning about linux namespaces](https://github.com/teddyking/ns-process)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankush-003%2Fgorunner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankush-003%2Fgorunner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankush-003%2Fgorunner/lists"}