Conversation
- Add cgroup.go with automatic v1/v2 detection - Add container.go with state management (created, running, exited, failed) - Implement rm, logs, and inspect CLI commands - Update info command to show cgroup details - Update ps command to show container states - Store container metadata in state.json files Co-authored-by: j143 <[email protected]>
- Add container_test.go with full test coverage for state management - Create verify-new.sh with structured test framework - Update README with container lifecycle, cgroup support, and new CLI commands - Document graceful degradation and state persistence Co-authored-by: j143 <[email protected]>
- Use io.MultiWriter to send output to both console and log file - Add warning logs for cgroup degradation instead of silent failures - Remove duplicate command/args extraction in run function - Improve verify-new.sh with proper binary validation and sudo usage Co-authored-by: j143 <[email protected]>
Complete documentation of all changes, improvements, and testing results Co-authored-by: j143 <[email protected]>
Copilot
AI
changed the title
[WIP] Narrow down learning project implementation
Stabilize core runtime: cgroup v1/v2 detection, container lifecycle, and CLI commands
Dec 31, 2025
j143
approved these changes
Dec 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Priority 1 from the roadmap: stabilizing the core container runtime with proper cgroup handling, state tracking, and essential CLI operations.
Changes
Cgroup support (
cgroup.go)memory.limit_in_bytes(v1) andmemory.max(v2)infocommandContainer lifecycle (
container.go)created→running→exited|failedstate.json(command, args, timestamps, exit code, PID)UpdateContainerState()CLI commands (
main.go)rm <id>- remove stopped containers, cleanup cgroupslogs <id>- read stdout/stderr from persistent log filesinspect <id>- dump full container metadata as JSONps- now shows actual states and creation timeinfo- displays cgroup version, controller availabilityLogging
io.MultiWriterto send output to both console and log file simultaneouslyTesting
container_test.gofor state managementverify-new.shwith 12 test scenariosExample
Original prompt
This section details on the original issue you should resolve
<issue_title>next</issue_title>
<issue_description>This is a solid, non‑trivial learning project that already goes well beyond “toy runtime”; it’s not something to abandon, but something to narrow, finish in layers, and then position as a reference implementation.[1]
Below is a concrete way to think about it.
What it is today
From the repo, you effectively have:[1]
basic-docker run,ps, minimal image/layer logic, filesystem isolation, namespaces, with some cgroup integration (currently permission‑sensitive).[1]monitor host|process|container|all|gap|correlationand a clear table of gaps. [1]ResourceCapsuleCRD, operator, andkubernetes.go/crd_*.goplumbing, plus ADRs for networking, image download, and resource capsules.[1]This is already a nice intersection of: containers internals, observability, and K8s custom resource design.[1]
What’s missing / incomplete
Reading the README, code list, and docs, the main gaps look like:[1]
Runtime robustness
memorycgroup path, limited feature flags).[1]Image and filesystem story
image.go, tests, real Docker image download), but no clear CLI forpull,images,rmi, caching policy, or clear OCI boundary.[1]Kubernetes / ResourceCapsule
Monitoring narrative
External readiness
go build ..[1]How to approach it (strategy)
Given your profile, this project should serve 3 purposes: concept mastery, a portfolio artifact, and a foundation for writing/talks. Explicitly pick that as the goal, not “replace Docker”.
Suggested approach:
Define a sharp scope: “lean Docker engine with monitoring + K8s capsules”
RESEARCH.md) with: goals, non‑goals, core constraints (single‑host, Linux only, root required).[1]Work in small, versioned milestones
Use ADRs aggressively
adr-00x. For every major decision (image format, network model, monitoring semantics, CRD shape) capture the tradeoffs and link back in README.[1]Concrete next priorities
Priority 1: Stabilize core runtime
Goal: “If you follow README steps on a modern Linux host as root, basic flows always work.”
Fix cgroup access + permission errors:
info.[1]Clarify lifecycle:
created,running,exited,failed.psand on‑disk metadata reflect it (e.g., per‑container JSON state file in/tmp/basic-docker/containers/<id>/state.json).[1]Round out CLI surface:
rm(cleanup directories),logs(even if it just tails stdout file), andinspect(dump container JSON state).💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.