Title
Issue 4: Docker Image Management – Load, Create, Save, and Cleanup
Summary
Implement the Docker Image Management layer for the local CI system: load pre-built images from .tar files, create new images when the registry has no matching image, save newly built images for reuse, enforce the image naming convention, and manage disk space by cleaning up old/unused images. This is the integration point between the Image Registry (Issue 3) and the Job Executor (Issue 5).
Goal
- Load images from
.tar files so jobs can run without pulling from a remote registry.
- Create new images on-demand when no image matches (using base image from registry + build steps).
- Save newly created images as
.tar and register them for future runs.
- Enforce a consistent naming convention and storage layout.
- Manage disk by removing old or rarely used images within configurable limits.
Context
- Depends on: Issue 3 (Image Registry and Matching Algorithm) — we get
best_image_path or best_base_image_path and needs_build from the execution plan.
- Feeds into: Issue 5 (Job Executor with act) — job execution calls this layer to prepare the image (load or build), then runs
act with the prepared image.
- Design reference: docs/Design Guide.md — Image Management System, Image Storage, Appendix E (New Image Creation Process), E.4 (Image Naming Convention).
Deliverables
Acceptance Criteria
- Load: Any registered
.tar path can be loaded and used for a job; errors for missing/corrupt files are explicit.
- Create: When registry returns “needs_build” with a base image, a new image is built, saved, and registered.
- Save: New images are written to
images/<project>/<name>.tar and appear in the registry.
- Naming: Only compliant names are accepted when saving/registering; examples are documented.
- Cleanup: Configurable cleanup keeps disk under the chosen limit and does not delete images that are still in use (e.g. referenced by current run).
References
- Design Guide: docs/Design Guide.md — Image Management System (Architecture), Image Storage & Image Registry Format (C), New Image Creation Process (E), Image Naming Convention (E.4),
docker load/docker save examples.
- Parent epic: Local CI System for Capy.
- Related: Issue 3 (Image Registry & Matching), Issue 5 (Job Executor with act).
Branch: feature/docker-image-management
Title
Issue 4: Docker Image Management – Load, Create, Save, and Cleanup
Summary
Implement the Docker Image Management layer for the local CI system: load pre-built images from
.tarfiles, create new images when the registry has no matching image, save newly built images for reuse, enforce the image naming convention, and manage disk space by cleaning up old/unused images. This is the integration point between the Image Registry (Issue 3) and the Job Executor (Issue 5).Goal
.tarfiles so jobs can run without pulling from a remote registry..tarand register them for future runs.Context
best_image_pathorbest_base_image_pathandneeds_buildfrom the execution plan.actwith the prepared image.Deliverables
Load images from
.tarimages/<project>/<name>.tar), rundocker load -i <path>.docker images) and return the image reference (name:tag) foract(-P <runner>=<image>).Create new images when no match found
needs_build = truewithbest_base_image_path:.tar..tar; update registry (or call registry API from Issue 3).Save newly built images for reuse
docker save -o <path> <image>:<tag>.images/<project>/<name>.tar(see Design Guide).image-registry.ymlor equivalent) so the matching algorithm can select this image on future runs.Image naming convention enforcement
<project>-<os>-<variant>.tar(e.g.capy-ubuntu-25.04-gcc15.tar,capy-ubuntu-25.04-clang20-asan.tar).Disk space management (cleanup old images)
.tarfiles and optionallydocker rmifor loaded copies) and optionally alocalci images prune(or similar) command.disk_min_free_gb-style limits from config if present (see Design Guide).Acceptance Criteria
.tarpath can be loaded and used for a job; errors for missing/corrupt files are explicit.images/<project>/<name>.tarand appear in the registry.References
docker load/docker saveexamples.Branch:
feature/docker-image-management