overlay

package
v1.41.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: Apache-2.0 Imports: 14 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupContent added in v1.8.4

func CleanupContent(containerDir string) (Err error)

CleanupContent removes every temporary mountpoint created under ${containerDir}/overlay as a result of however many calls to TempDir(), roughly equivalent to calling RemoveTemp() for each of the directories whose paths it returned, and then removes ${containerDir} itself.

func CleanupMount added in v1.13.0

func CleanupMount(contentDir string) (Err error)

CleanupMount removes all temporary mountpoint content

func GenerateStructure added in v1.22.2

func GenerateStructure(containerDir, containerID, name string, rootUID, rootGID int) (string, error)

GenerateStructure generates an overlay directory structure for container content

func Mount added in v1.13.0

func Mount(contentDir, source, dest string, rootUID, rootGID int, graphOptions []string) (mount specs.Mount, Err error)

Mount creates a subdir of the contentDir based on the source directory from the source system. It then mounts up the source directory on to the generated mount point and returns the mount point to the caller.

func MountReadOnly added in v1.17.0

func MountReadOnly(contentDir, source, dest string, rootUID, rootGID int, graphOptions []string) (mount specs.Mount, Err error)

MountReadOnly creates a subdir of the contentDir based on the source directory from the source system. It then mounts up the source directory on to the generated mount point and returns the mount point to the caller. Note that no upper layer will be created rendering it a read-only mount

func MountWithOptions added in v1.24.0

func MountWithOptions(contentDir, source, dest string, opts *Options) (mount specs.Mount, Err error)

MountWithOptions creates ${contentDir}/merge, where ${contentDir} was presumably created and returned by a call to TempDir(), and either mounts a filesystem there and returns a mounts.Spec which bind-mounts the mountpoint to ${dest}, or returns a mounts.Spec which mounts a filesystem at ${dest}. Options allows the caller to configure a custom workdir and upperdir, indicate whether or not the overlay should be read-only, and provide the graph driver options that we'll search to determine whether or not we should be using a mount helper (i.e., fuse-overlayfs). This API is used by podman.

func RemoveTemp

func RemoveTemp(contentDir string) error

RemoveTemp unmounts a filesystem mounted at ${contentDir}/merge, and then removes ${contentDir}, which is typically a path returned by TempDir(), along with any contents it might still have.

func TempDir added in v1.13.0

func TempDir(containerDir string, rootUID, rootGID int) (string, error)

TempDir generates a uniquely-named directory under ${containerDir}/overlay which can be used as a parent directory for the upper and working directories for an overlay mount, creates "upper" and "work" directories beneath it, and then returns the path of the new directory.

func Unmount added in v1.13.0

func Unmount(contentDir string) error

Unmount the overlay mountpoint at ${contentDir}/merge, where ${contentDir} is typically a path returned by TempDir(). The mountpoint itself is left unmodified.

Types

type Options added in v1.24.0

type Options struct {
	// The Upper directory is normally writable layer in an overlay mount.
	// Note!! : Following API does not handles escaping or validates correctness of the values
	// passed to UpperDirOptionFragment instead API will try to pass values as is it
	// to the `mount` command. It is user's responsibility to make sure they pre-validate
	// these values. Invalid inputs may lead to undefined behaviour.
	// This is provided as-is, use it if it works for you, we can/will change/break that in the future.
	// See discussion here for more context: https://github.com/containers/buildah/pull/3715#discussion_r786036959
	// TODO: Should we address above comment and handle escaping of metacharacters like
	// `comma`, `backslash` ,`colon` and any other special characters
	UpperDirOptionFragment string
	// The Workdir is used to prepare files as they are switched between the layers.
	// Note!! : Following API does not handles escaping or validates correctness of the values
	// passed to WorkDirOptionFragment instead API will try to pass values as is it
	// to the `mount` command. It is user's responsibility to make sure they pre-validate
	// these values. Invalid inputs may lead to undefined behaviour.
	// This is provided as-is, use it if it works for you, we can/will change/break that in the future.
	// See discussion here for more context: https://github.com/containers/buildah/pull/3715#discussion_r786036959
	// TODO: Should we address above comment and handle escaping of metacharacters like
	// `comma`, `backslash` ,`colon` and any other special characters
	WorkDirOptionFragment string
	// Graph options being used by the caller, will be searched when choosing mount program
	GraphOpts []string
	// Mark if following overlay is read only
	ReadOnly bool
	// Deprecated: RootUID is not used
	RootUID int
	// Deprecated: RootGID is not used
	RootGID int
	// Force overlay mounting and return a bind mount, rather than
	// attempting to optimize by having the runtime actually mount and
	// manage the overlay filesystem.
	ForceMount bool
	// MountLabel is a label to force for the overlay filesystem.
	MountLabel string
}

Options for MountWithOptions().

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL