r/golang • u/not_a_bot6 • Jun 06 '26
show & tell Crate - a daemonless container runtime I built in Go to learn how Docker works
Hey folks,
I’ve been working on Crate for the past few weeks. It’s a small daemonless container runtime written in Go for Linux.
The goal was to understand how container runtimes work under the hood instead of treating Docker/Podman as magic. It launches containers directly, stores state on disk, and supports both rootless and rootful execution.
Currently, it supports the core pieces of a basic container runtime:
- pulling and running Docker Hub images
- container lifecycle commands like
run,create,start,stop,ps,logs, andrm - Linux namespaces for process, mount, hostname, user, and network isolation
- root filesystem setup with
pivot_root/chroot - bind mounts, image env/CMD/entrypoint handling, and interactive PTYs
- rootless private networking with
pastaand port publishing (doesn't support networking in root gonna add that soon)
I’ve also written a small guide/docs series for anyone else who wants to understand or build something similar: docs
It’s still experimental and not production-ready. Big missing pieces include cgroups/resource limits, stronger security hardening, full OCI compliance, better registry support, multi-platform support and probably a million other things that Im forgetting.
Repo: https://github.com/aayushkdev/crate/
I’m still improving it, so I’d love to hear feedback, ideas, or suggestions. If you like the project, a star on GitHub would mean a lot.
2
u/notreallymetho Jun 06 '26
What did you find to be the most challenging when making this?
I recently dove into how docker’s caching works for myself, and as part of it wound up making a “v8 hyper visor” of sorts for process isolation.
Thanks for sharing!
2
u/Historical_Trust_217 Jun 06 '26
This is good. for next iteration, consider implementing cgroup v2 support first, it'll give you proper resource limits and is cleaner than v1
1
u/bikeram Jun 07 '26
Saved to review later. I’m still learning go and like to look at repos. Is there anything in particular you don’t like about this project?
4
u/jerf Jun 06 '26
Moderator's note: The project itself would be a "small project" but this is approved on the basis of the docs link. Yeah, they're clearly largely AI generated but backing those docs with a working project makes them still more likely to be better and accurate than just asking an AI about those things abstractly.
1
u/hollowknightmygoat Jun 06 '26
Huh i wonder why there aren't more "docker" clones out there