Occystrap Compatibility Enhancement Plan¶
Status: Proposed. Written 2026-06-20 and left in the repository
root until 2026-12-01, when it was moved here and registered.
Priority 1 (zstd) and Priority 4 (compression format detection)
have since shipped in occystrap/compression.py; priorities 2, 3,
5 and 6 are still open. This document predates
PLAN-TEMPLATE.md, so it does not carry the Prompt, Situation and
Mission sections a new plan would.
This document outlines potential compatibility improvements for occystrap, prioritized by practical impact and implementation complexity.
Priority 1: Zstd Compression Support¶
Problem¶
Docker 25+ with OCI format can produce zstd-compressed layers. Currently, occystrap only handles gzip compression, meaning zstd-compressed images will fail to decompress with an unclear error.
Scope¶
- Input side: Detect and decompress zstd-compressed layers from registries and tarballs
- Output side: Optionally compress layers with zstd when pushing to registries (with gzip as default for backwards compatibility)
Implementation Approach¶
- Add
zstandardPython package as a dependency - Detect compression format from layer media type:
application/vnd.oci.image.layer.v1.tar+zstdapplication/vnd.docker.image.rootfs.diff.tar.zstd- Update
inputs/registry.pyto handle zstd decompression alongside gzip - Update
inputs/tarfile.pyto detect and decompress zstd layers in OCI tarballs - Add
--compressionflag to registry output (choices: gzip, zstd) - Update media types in output manifests accordingly
Test Data Needed¶
- Docker 25+ tarball with zstd-compressed layers
- Registry image with zstd layers (if readily available)
Estimated Complexity¶
Medium - straightforward decompression logic, but touches multiple files and needs test coverage.
Priority 2: OCI Manifest Format Preservation¶
Problem¶
Occystrap accepts multiple manifest formats on input but always outputs Docker v2 format. This changes image format during round-trips, which may matter for:
- Registries requiring OCI compliance
- Signature verification that depends on manifest format
- Tooling that expects specific manifest types
Scope¶
- Preserve original manifest format when pushing to registry
- Add option to explicitly choose output format
Implementation Approach¶
- Track source manifest format through the pipeline
- Add
--manifest-formatflag to registry output (choices: docker-v2, oci, preserve) - Update
outputs/registry.pyto generate appropriate manifest structure: - Docker v2: current behaviour
- OCI:
application/vnd.oci.image.manifest.v1+jsonwith OCI layer types - Handle media type mapping between formats
Considerations¶
- Config blob format is largely the same between Docker and OCI
- Layer media types need translation:
- Docker:
application/vnd.docker.image.rootfs.diff.tar.gzip - OCI:
application/vnd.oci.image.layer.v1.tar+gzip
Estimated Complexity¶
Medium - mostly manifest generation changes, but needs careful testing of registry compatibility.
Priority 3: Multi-Architecture Image Support¶
Problem¶
Occystrap can read manifest lists and select an architecture, but cannot:
- Create new manifest lists/indices
- Preserve multi-arch structure through round-trips
- Combine single-arch images into a multi-arch image
Scope¶
This is a larger feature that may be better addressed incrementally:
- Phase 1: Preserve multi-arch structure when round-tripping (pull all architectures, push as manifest list)
- Phase 2: Create manifest lists from multiple single-arch images
- Phase 3: Add/remove architectures from existing manifest lists
Implementation Approach (Phase 1 only)¶
- Add
--all-architecturesflag to registry input - Store multiple architecture variants in pipeline
- Update registry output to create manifest list when multiple variants exist
- Handle both Docker manifest list and OCI image index formats
Considerations¶
- Significantly increases complexity of the pipeline model
- Storage requirements multiply with each architecture
- May require rethinking the single-image-at-a-time model
Estimated Complexity¶
High - requires architectural changes to support multiple images in pipeline.
Priority 4: Compression Format Detection and Handling¶
Problem¶
Beyond zstd, layers can theoretically be:
- Uncompressed (
application/vnd.oci.image.layer.v1.tar) - Bzip2 compressed (rare)
- XZ compressed (rare)
Scope¶
- Detect and handle uncompressed layers (most practical)
- Document unsupported compression formats with clear errors
Implementation Approach¶
- Check media type and/or magic bytes to detect compression
- Handle uncompressed layers (pass through without decompression)
- Raise clear errors for unsupported formats (bzip2, xz) rather than cryptic decompression failures
Estimated Complexity¶
Low - mostly error handling improvements.
Priority 5: Filesystem Compatibility for Mounts Output¶
Problem¶
The mounts output uses extended attributes (trusted.overlay.opaque) for
opaque directory markers. This fails silently or with confusing errors on
filesystems without xattr support.
Scope¶
- Detect xattr support before attempting to set attributes
- Provide clear error message when filesystem doesn't support required features
- Document filesystem requirements
Implementation Approach¶
- Add filesystem capability check before mounts output begins
- Test xattr support by attempting to set/get a test attribute
- Fail early with actionable error message listing supported filesystems
Estimated Complexity¶
Low - primarily validation and error messaging.
Priority 6: OCI Bundle Completeness¶
Problem¶
The ocibundle output generates minimal runtime configs. Some image features
may not translate:
- Health checks
- Stop signals
- Complex entrypoint/cmd combinations
- Resource limits specified in image config
Scope¶
- Audit OCI runtime spec coverage
- Add missing config translations
- Document any intentionally unsupported features
Implementation Approach¶
- Review OCI runtime spec against current implementation
- Map Docker/OCI image config fields to runtime config equivalents
- Add missing translations (or document why they're omitted)
Estimated Complexity¶
Medium - requires understanding both image and runtime specs thoroughly.
Recommendation¶
I suggest tackling these in order:
- Zstd compression - Real-world breakage as Docker 25+ adoption grows
- OCI manifest format - Improves interoperability with OCI-native tooling
- Better error handling (priorities 4-5) - Quick wins for user experience
Multi-architecture support (priority 3) is valuable but represents a larger architectural change that warrants its own design discussion.
Questions for Discussion¶
-
Is zstd output compression worth implementing, or just zstd input? (Output adds complexity for limited benefit if most registries still expect gzip)
-
For manifest format preservation, should "preserve" be the default, or should we default to Docker v2 for maximum compatibility?
-
Is multi-architecture support actually needed for occystrap's use cases, or is the current "select one architecture" model sufficient?
-
Are there specific registries or runtimes we should test against for compatibility validation?