Lightweight container runtime and tooling written in Go — includes the runtime daemon
gontainerdand the CLIgontainerfor managing containers and images.
Gontainer is a minimal Docker like container runtime implemented in Go. It provides a small daemon (gontainerd) and a CLI (gontainer) to manage images and containers via a Unix socket (/var/run/gontainer.sock). The project is intentionally small and designed to be a learning-friendly runtime that can be extended.
Build the binaries using the Makefile:
make buildStart the daemon (require root):
sudo ./bin/gontainerd &Run a container from a local image (example):
./bin/gontainer run --rm -d alpineImplemented commands (see cmd/gontainer):
-
gontainer run [image]— Run a container from an image- Flags:
--name, -n <name>: set container name
- Flags:
-
gontainer ps— List running containers- Flags:
--all, -a: show all containers
- Flags:
-
gontainer rm [container...]— Remove one or more containers by id or name- Flags:
--force, -f: force remove running containers
- Flags:
-
gontainer rmi [image...]— Remove one or more images -
gontainer images— List local images -
gontainer image ls(alias:image list) — List local images (same asimages) -
gontainer image rm [image...]— Remove image(s) (alias forrmi) -
gontainer attach [container]— Attach to a running container
These commands communicate with the gontainerd daemon via the Unix socket at /var/run/gontainer.sock.
The repository ships simple images under images/<name>/ with a small metadata.json. Below is a suggested, minimal image layout and fields to use when implementing pull/push and tag handling:
images/
alpine/
metadata.json
rootfs.tar
name(string): repository name (e.g.,alpine).
cmd(string): default command to run (e.g.,/bin/sh).env(object): environment variables map (e.g.,{ "PATH": "/usr/bin:..." }).
- Registry support (mostly done) — finish and document registry features
- Networking — handle network namespaces and port mapping (e.g. bridge, port forwarding)
-
pullcommand — pull images from registry (not implemented) -
pushcommand — push images to registry (not implemented) -
stopcommand — stop a running container (not implemented) -
startcommand — start a stopped container (not implemented) - Recovery system for daemon — implement restart/recovery of running containers on daemon restart (not-started)
- Persistent store for daemon — persist container and image state to disk (not-started)
- Tags system for images — support repository:tag semantics and tag operations (not-started)
- List running containers:
./bin/gontainer ps- Remove a container:
./bin/gontainer rm <container-id>Thanks for considering a contribution! All contributions are welcome. If you'd like to contribute:
- Open an issue first for larger changes to discuss the approach.
- Fork the repo and create a topic branch for your work.
- Send a pull request with a clear description and, where appropriate, tests.
