﻿# Explain why deleting a model from a later image layer retains earlier bytes

A later image-layer deletion changes visibility through whiteouts; inspect referenced layers before claiming earlier model bytes were removed or erased.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-storage-container-whiteout/
Language: en

A container image adds a checkpoint in one layer and deletes it in a later layer. The final filesystem view no longer shows the file, yet the earlier layer still carries its bytes. Image layers describe changesets, not destructive editing of previous blobs. Distinguish merged visibility, writable-container state and retained image content before claiming that deletion reduced distribution size or erased an artifact.

## Read the layer contract

OCI image layers represent filesystem changes applied in order. Adding, replacing and removing paths changes the resulting view without modifying an already published lower-layer blob. Preserve image digest and layer inventory when explaining size. A file absent from a running container can still exist in an earlier image layer distributed with that image's history.

## Interpret whiteouts correctly

The OCI specification defines whiteout entries and opaque-directory behavior for removal semantics in layer changesets. These are instructions for building the merged view, not proof that older bytes were overwritten on storage. Kernel overlay representations and OCI archive markers also belong to different implementation boundaries. Do not manipulate runtime internals or assume one marker format can be copied indiscriminately between them.

## Separate runtime deletion

A container's writable state can hide a file inherited from its image without changing the source image. Deleting the container's local writable layer is another lifecycle operation, while the image and shared lower layers may remain referenced elsewhere. Keep those populations separate. A lower visible directory size does not automatically describe image-download bytes, unique local disk use or the set retained by the runtime's content store.

## Prepare the intended final image

If a model artifact should not be distributed in the final image, exclude it from the final accepted layer set rather than relying on a later deletion to conceal it. Use the build system's supported construction and inspect the resulting artifact. This is also an integrity and information-retention question: absence from the merged namespace is insufficient evidence that a previously included file is unavailable to someone possessing the image layers.

## Verify the delivered artifact

Inspect the final image's referenced layers and effective filesystem under the deployed storage backend. Record which bytes remain in the distributable artifact and which local state belongs only to a container. A useful result explains retained content and visible removal. It does not promise secure erasure, immediate storage reclamation or identical accounting across classic drivers and snapshotter-based image stores.

## Primary references

[OCI Image Layer Changeset and Whiteout Specification](https://github.com/opencontainers/image-spec/blob/main/layer.md).

[Linux OverlayFS Copy-Up and Whiteout Semantics](https://docs.kernel.org/filesystems/overlayfs.html).

[Docker Image Layers and Writable Container State](https://docs.docker.com/engine/storage/drivers/).

Related reading: [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/); [Model caches and SSD endurance: downloads, host writes and NAND](/journal/model-cache-ssd-write-amplification/).
