Skip to content

Inline cache does not apply to FROM DOCKERFILE layers #395

@gilescope

Description

@gilescope

Summary

Layers built inside a FROM DOCKERFILE block do not benefit from --save-inline-cache / --use-inline-cache. Local BuildKit layer caching works fine — the issue is specifically that the inline cache mechanism does not appear to cover layers produced by the Dockerfile frontend.

Minimal reproduction

# images/node/Dockerfile
FROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal@sha256:13bffb7...
RUN microdnf -y install ca-certificates curl-minimal jq && \
    microdnf clean all
VERSION 0.8

node-image:
    FROM DOCKERFILE -f ./images/node/Dockerfile .
    SAVE IMAGE --push ghcr.io/example/node:latest
earthly --use-inline-cache --save-inline-cache --push +node-image

On a fresh runner (no local BuildKit cache), the microdnf install layer rebuilds every time despite nothing in the Dockerfile having changed.

Question

Is there something we need to pass through to BuildKit (e.g. BUILDKIT_INLINE_CACHE=1 or equivalent) so that the Dockerfile frontend embeds inline cache metadata into its layers? Or is this a known limitation of FROM DOCKERFILE?

Workaround

Converting to native Earthfile FROM + RUN commands makes inline caching work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions