Skip to content

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

  1. Add zstandard Python package as a dependency
  2. Detect compression format from layer media type:
  3. application/vnd.oci.image.layer.v1.tar+zstd
  4. application/vnd.docker.image.rootfs.diff.tar.zstd
  5. Update inputs/registry.py to handle zstd decompression alongside gzip
  6. Update inputs/tarfile.py to detect and decompress zstd layers in OCI tarballs
  7. Add --compression flag to registry output (choices: gzip, zstd)
  8. 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

  1. Track source manifest format through the pipeline
  2. Add --manifest-format flag to registry output (choices: docker-v2, oci, preserve)
  3. Update outputs/registry.py to generate appropriate manifest structure:
  4. Docker v2: current behaviour
  5. OCI: application/vnd.oci.image.manifest.v1+json with OCI layer types
  6. 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:

  1. Phase 1: Preserve multi-arch structure when round-tripping (pull all architectures, push as manifest list)
  2. Phase 2: Create manifest lists from multiple single-arch images
  3. Phase 3: Add/remove architectures from existing manifest lists

Implementation Approach (Phase 1 only)

  1. Add --all-architectures flag to registry input
  2. Store multiple architecture variants in pipeline
  3. Update registry output to create manifest list when multiple variants exist
  4. 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

  1. Check media type and/or magic bytes to detect compression
  2. Handle uncompressed layers (pass through without decompression)
  3. 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

  1. Add filesystem capability check before mounts output begins
  2. Test xattr support by attempting to set/get a test attribute
  3. 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

  1. Review OCI runtime spec against current implementation
  2. Map Docker/OCI image config fields to runtime config equivalents
  3. 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:

  1. Zstd compression - Real-world breakage as Docker 25+ adoption grows
  2. OCI manifest format - Improves interoperability with OCI-native tooling
  3. 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

  1. Is zstd output compression worth implementing, or just zstd input? (Output adds complexity for limited benefit if most registries still expect gzip)

  2. For manifest format preservation, should "preserve" be the default, or should we default to Docker v2 for maximum compatibility?

  3. Is multi-architecture support actually needed for occystrap's use cases, or is the current "select one architecture" model sufficient?

  4. Are there specific registries or runtimes we should test against for compatibility validation?

📝 Report an issue with this page