Documentation
¶
Overview ¶
Package oci loads container images into flat file trees that catalogers can walk. It reads two on-disk shapes without any registry access: a `docker save` tarball (manifest.json + layer tars) and an OCI image layout (an `oci-layout`/`index.json`/`blobs` directory, or that same layout inside a tar). Layers are applied in order with whiteout semantics so the result is the image's effective filesystem. It re-implements only what it needs from the OCI spec; it does not depend on any container tooling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// Path is a slash-separated path relative to the tree root, with no
// leading slash (e.g. "var/lib/dpkg/status").
Path string
Mode fs.FileMode
Size int64
// Data holds the full file contents. Images are loaded into memory; this
// is fine for the small fixtures the tool is tested against and keeps
// catalogers simple. Large-image streaming is a later concern.
Data []byte
}
File is a regular file extracted from an image layer or a filesystem.
type FileTree ¶
type FileTree struct {
// contains filtered or unexported fields
}
FileTree is the flattened, effective filesystem of an image (or a scanned directory): the union of all layers with whiteouts applied.
func TreeFromDir ¶
TreeFromDir walks an on-disk directory into a FileTree, as if it were a flattened image root. Symlinks are skipped; only regular files are read.
func TreeFromMap ¶
TreeFromMap builds a FileTree from a path -> contents map. Paths are normalized (leading slashes and "./" stripped). It is a convenience for callers that already hold file contents in memory, and for tests.
type Image ¶
type Image struct {
// RepoTags are the "name:tag" references recorded for the image, if any.
RepoTags []string
// ConfigDigest is the sha256 digest of the image config blob (e.g.
// "sha256:abc..."), or "" if unknown.
ConfigDigest string
// Config is the raw image config JSON.
Config []byte
Layers []*Layer
}
Image is a loaded container image.
type Layer ¶
type Layer struct {
Index int
Digest string
Files []*File
// Whiteouts lists whiteout markers this layer carried, as cleaned paths of
// the deleted target (opaque markers keep their ".wh..wh..opq" basename).
Whiteouts []string
}
Layer is one image layer: the raw set of entries it introduced, before any whiteouts from later layers are applied. Keeping per-layer files available lets later capabilities (e.g. secret scanning) inspect deleted content.