Skip to content

fix: clean up podman temp layer extracts after build - #2656

Open
locker95 wants to merge 1 commit into
buildpacks:mainfrom
locker95:fix/cleanup-podman-temp-layers-1167
Open

locker95 wants to merge 1 commit into
buildpacks:mainfrom
locker95:fix/cleanup-podman-temp-layers-1167

Conversation

@locker95

@locker95 locker95 commented Jul 20, 2026 •

Copy link
Copy Markdown

Summary

With podman, ephemeral builder saves cannot omit base layers the way Docker allows. imgutil falls back to extracting builder layers under /tmp/imgutil.local.image.* and historically never deleted those dirs, so repeated pack build filled /tmp (especially painful when /tmp is on tmpfs).

The cleanup is implemented in imgutil: after Save/SaveFile finish reading extracted base layers, those temp dirs are removed. Layers pack adds on purpose (builder scratch artifacts, daemon/image cache) are not deleted.

Output

Before

# after pack build with podman
$ ls -d /tmp/imgutil.local.image.*
/tmp/imgutil.local.image.xxx
/tmp/imgutil.local.image.yyy   # accumulates on every build

After

# extract dirs are removed when Save returns
$ ls -d /tmp/imgutil.local.image.*
ls: cannot access '/tmp/imgutil.local.image.*': No such file or directory

Documentation

  • Should this change be documented?
    • Yes, see #___
    • No

Related

Resolves #1167
Depends on buildpacks/imgutil#309

@locker95
locker95 requested review from a team as code owners July 20, 2026 19:17
@github-actions github-actions Bot added this to the 0.41.0 milestone Jul 20, 2026
@github-actions github-actions Bot added the type/chore Issue that requests non-user facing changes. label Jul 20, 2026
@locker95
locker95 force-pushed the fix/cleanup-podman-temp-layers-1167 branch from 42e485a to e3c1b44 Compare August 12, 2026 19:47
@locker95
locker95 force-pushed the fix/cleanup-podman-temp-layers-1167 branch from e3c1b44 to e434050 Compare October 13, 2026 01:19
@locker95
locker95 force-pushed the fix/cleanup-podman-temp-layers-1167 branch from e434050 to eaf8888 Compare October 25, 2026 07:31
@locker95
locker95 force-pushed the fix/cleanup-podman-temp-layers-1167 branch from eaf8888 to 0135886 Compare November 2, 2026 20:03
When the daemon rejects sparse/omit-base-layer saves (podman), imgutil
extracts builder layers under /tmp/imgutil.local.image.* and previously
left them behind after pack build. Bump imgutil to a revision that
removes those extract dirs after Save/SaveFile, without touching
intentionally cached layers or builder scratch artifacts.

Depends on: buildpacks/imgutil (locker95 fix/cleanup-download-temp-dirs)
replace points at the fix until it lands on buildpacks/imgutil.

Fixes buildpacks#1167

Signed-off-by: Dean Chen <862469039@qq.com>
@locker95
locker95 force-pushed the fix/cleanup-podman-temp-layers-1167 branch from 0135886 to 7ef57d2 Compare November 3, 2026 22:53

This branch has not been deployed

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

Labels

type/chore Issue that requests non-user facing changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Temporary files are not deleted after build

1 participant