Skip to content

Use an OCI image parsing library for FROM instructions in Dockerfiles #931

@xunleii

Description

@xunleii

Is your feature request related to a problem? Please describe.
Manually parsing the FROM fields in Dockerfiles can quickly become complex and error-prone, especially when handling the different possible syntaxes (e.g., digests, aliases, platform selectors). This led to issues in PR #930, as noted in the review: #930 (comment)

Describe the solution you'd like
Use a standard OCI image parsing library to extract and manipulate fields from Dockerfile FROM instructions. This would improve robustness and maintainability of the code and avoid reinventing parsing logic.

Describe alternatives you've considered
Keep the custom in-house parsing logic, but that requires ongoing maintenance and increases the risk of bugs. A dedicated parsing library would provide stronger guarantees and reduce maintenance burden.

Additional context
Example discussion and justification in PR #930: #930 (comment)
There are existing libraries to parse OCI image references depending on Go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions