Skip to content

fix: Support OCI and compressed layer extraction#693

Open
Vortelf wants to merge 1 commit intowagoodman:mainfrom
Vortelf:fix-file-extract-oci
Open

fix: Support OCI and compressed layer extraction#693
Vortelf wants to merge 1 commit intowagoodman:mainfrom
Vortelf:fix-file-extract-oci

Conversation

@Vortelf
Copy link
Copy Markdown

@Vortelf Vortelf commented Apr 9, 2026

Fixes #687

Problem

  • The Extract function was failing to extract files from Docker image layers for OCI-format images (the default since Docker 25+)

Root Causes

  1. Layer ID extraction was wrong for OCI format images
  • dive/image/docker/layer.go used strings.Split(tree.Name, "/")[0] to derive the layer ID which only works for Docker images and therefor it was always failing to retrieve the layer for OCI images.
  • ExtractFromImage searched for entries named <layer-id>/layer.tar and OCI images store layers as blobs/sha256/<digest> which was also causing a mismatch when searching the source from which to extract the files.
  1. No compression detection for OCI blob layers

Misc

  • Tidied up the error handling a bit around this functionality, because it was constantly failing silently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot extract file

1 participant