{"id":29778840,"url":"https://github.com/davincedev/container-test","last_synced_at":"2025-07-27T13:03:56.761Z","repository":{"id":305515878,"uuid":"1020931069","full_name":"DaVinceDev/container-test","owner":"DaVinceDev","description":"Zig container mini runtime","archived":false,"fork":false,"pushed_at":"2025-07-20T14:58:55.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-20T15:41:19.619Z","etag":null,"topics":["containerization","cool-stuff","docker","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/DaVinceDev.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}},"created_at":"2025-07-16T15:59:44.000Z","updated_at":"2025-07-20T14:58:28.000Z","dependencies_parsed_at":"2025-07-20T15:41:28.232Z","dependency_job_id":"5242637e-9a74-4da4-a551-901d16830d97","html_url":"https://github.com/DaVinceDev/container-test","commit_stats":null,"previous_names":["davincedev/container-test"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/DaVinceDev/container-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaVinceDev%2Fcontainer-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaVinceDev%2Fcontainer-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaVinceDev%2Fcontainer-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaVinceDev%2Fcontainer-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DaVinceDev","download_url":"https://codeload.github.com/DaVinceDev/container-test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DaVinceDev%2Fcontainer-test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267361534,"owners_count":24074950,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"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":["containerization","cool-stuff","docker","zig"],"created_at":"2025-07-27T13:01:23.143Z","updated_at":"2025-07-27T13:03:56.731Z","avatar_url":"https://github.com/DaVinceDev.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig Container Mini-Runtime\n\nThis project is a mini container runtime built from scratch. It teached me how containers work under the hood using linux syscalls like: clone,unshare,\nmount,chroot,etc; along with new knowledge about memory management in zig.\n\n## How to test it\n\nThis is a step-by-step on how to get the container up and running to test it and see its limitations:\n\n0º If you don't already have it, download docker and make sure it's working by running `docker run hello`\n\n1º Clone the repository `git clone https://github.com/DaVinceDev/container-test`\n\nNOTE: DO NOT! AND I REPEAT DO NOT RUN THIS OUTSIDE THE DOCKER CONTAINER, WHATEVER HAPPENS IT'S YOUR FAULT.\n\n2º Go to the repo directory and create a docker container using the Dockerfile\n\n`cd container-test/`\n`docker build -t \u003ccontainer_name\u003e .`\n\n3º Run the container with the necessary permissions, the code will not run if it doesn't\n\n`docker run --cap-add=SYS_ADMIN --cap-add=SYS_CHROOT --cap-add=SYS_PTRACE -it \u003ccontainername\u003e`\n\n4º Build the executable for the container, running the code directly fails when it comes to fetching for PID's \n\n`zig build-exe container.zig`\n\n5º Run the executable and pass an argument like `bash`. The best argument for the test anyways lol\n\n`./container bash`\n\nThere! You're inside a container.\n\n## Testing\n\nNow that you're inside the container, you might want to test atleast two things:\n\nHostname test\nFetch for PID's\n\n### Hostname test \n\nInside the container(assuming you passed bash as argument) type the `hostname` command and it'll echo the container hostname. To change it you just go \n`hostname zig-box` or whatever you want to call it. Then again try `hostname` and it'll echo the name you gave it. Now exit the container and try `hostname`\nand it should echo the development container ID.\n\n\n### Fetch for PID's\n\nAgain, assuming you're inside the container (not the dev one) if you try to type `ps` it will fail because it's not installed. But then you might notice you're \ninside a ubuntu container(development one) so it should have ps command. Happens that the rootfs(root filesystem) does not have ps by default in the test \ncontainer. But you can install it with:\n\n`apt-get update` to update the database \n`apt-get procps` to install `ps`\n\nAnd then you can try again `ps` and should show: the container, bash and ps. And you now it's working if the TTY's are unknow.\n\n\n## How does it work?\n\nYou can check the code and the notes to see and understand the process behind it. \n\n\n## CREDITS \n\nThis code is an adaptation in zig of this video:\n\n**Containers from scratch in Go**: https://youtu.be/Utf-A4rODH8?si=jzC6Zg0cWRUceNRD\n\nThis **Liz Rice** did an amazing job at simplifying the process of creation of a container and it would be my bad if I didn't mention her and the reference of \nthis project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavincedev%2Fcontainer-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavincedev%2Fcontainer-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavincedev%2Fcontainer-test/lists"}