Guntainer is a minimal container runtime implemented in Go. It demonstrates how Linux containers work internally by directly using Linux kernel primitives such as namespaces and filesystem isolation, without relying on Docker or other container engines.
-
Uses Linux namespaces (PID, Mount, UTS, IPC, User) to isolate processes, providing the core mechanism that makes a container a container.
-
Leverages user namespaces to map container root (UID 0) to the invoking host user, allowing containers to run without real root privileges.
-
Sets up an isolated root filesystem using a minimal Ubuntu rootfs combined with
chrootand mount namespaces. -
The runtime re-executes itself to transition from the host context into the container context, mirroring how real container runtimes bootstrap isolated processes.
-
Provides a minimal command-line interface to execute arbitrary commands inside the isolated environment.
guntainer run /bin/bashguntainer run idThe command will run with UID 0 inside the container while remaining unprivileged on the host.
go install github.com/eswar-7116/guntainer@latestEnsure $GOPATH/bin (or $HOME/go/bin) is in your PATH.
git clone https://github.com/eswar-7116/guntainer.git
cd guntainer
go build -o guntainer-
Guntainer depends on Linux-specific kernel features such as namespaces,
clone, UID/GID mapping, mount namespaces, etc.- Linux: ✅ supported
- macOS: ❌ not supported
- Windows: ❌ not supported
macOS is Unix-based but does not implement Linux kernel primitives required by this project.
-
Network namespaces are not implemented. Containers share the host network stack.
-
cgroups are not used because they need elevated privileges. CPU and memory usage are unrestricted.
-
There is no layered image format, registry support, or caching mechanism.
-
This runtime is intended strictly for learning and experimentation.
Guntainer is a minimal, educational container runtime designed to explain containers from first principles. It focuses on clarity and correctness over features, making it suitable for developers interested in Linux internals, systems programming, and understanding how tools like Docker work beneath the surface.