volumes

package
v1.41.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeTmpfs is the type for mounting tmpfs
	TypeTmpfs = "tmpfs"
	// TypeCache is the type for mounting a common persistent cache from host
	TypeCache = "cache"

	// mount=type=cache allows users to lock a cache store while its being used by another build
	BuildahCacheLockfile = "buildah-cache-lockfile"
	// All the lockfiles are stored in a separate directory inside `BuildahCacheDir`
	// Example `/var/tmp/buildah-cache/<target>/buildah-cache-lockfile`
	BuildahCacheLockfileDir = "buildah-cache-lockfiles"
)

Variables

This section is empty.

Functions

func CacheParent added in v1.32.0

func CacheParent() string

CacheParent returns a cache parent for --mount=type=cache

func GetBindMount added in v1.32.0

func GetBindMount(sys *types.SystemContext, args []string, contextDir string, store storage.Store, mountLabel string, additionalMountPoints map[string]internal.StageMountDetails, workDir, tmpDir string) (specs.Mount, string, string, string, error)

FIXME: this code needs to be merged with pkg/parse/parse.go ValidateVolumeOpts

GetBindMount parses a single bind mount entry from the --mount flag.

Returns a Mount to add to the runtime spec's list of mounts, the ID of the image we mounted if we mounted one, the path of a mounted location if one needs to be unmounted and removed, and the path of an overlay mount if one needs to be cleaned up, or an error.

The caller is expected to, after the command which uses the mount exits, clean up the overlay filesystem (if we provided a path to it), unmount and remove the mountpoint for the mounted filesystem (if we provided the path to its mountpoint), and then unmount the image (if we mounted one).

func GetCacheMount added in v1.32.0

func GetCacheMount(sys *types.SystemContext, args []string, store storage.Store, mountLabel string, additionalMountPoints map[string]internal.StageMountDetails, uidmap, gidmap []specs.LinuxIDMapping, workDir, tmpDir string) (specs.Mount, string, string, string, *lockfile.LockFile, error)

GetCacheMount parses a single cache mount entry from the --mount flag.

Returns a Mount to add to the runtime spec's list of mounts, the ID of the image we mounted if we mounted one, the path of a mounted filesystem if one needs to be unmounted, the path of an overlay if one needs to be cleaned up, and an optional lock that needs to be released, or an error.

The caller is expected to, after the command which uses the mount exits, clean up the overlay filesystem (if we provided the path of one), unmount and remove the mountpoint of the mounted filesystem (if we provided the path to its mountpoint), unmount the image (if we mounted one), and release the lock (if we took one).

func GetTmpfsMount added in v1.32.0

func GetTmpfsMount(args []string, workDir string) (specs.Mount, error)

GetTmpfsMount parses a single tmpfs mount entry from the --mount flag

func GetVolumes added in v1.32.0

func GetVolumes(ctx *types.SystemContext, store storage.Store, mountLabel string, volumes []string, mounts []string, contextDir string, idMaps define.IDMappingOptions, workDir, tmpDir string) ([]specs.Mount, []string, []string, []string, []*lockfile.LockFile, error)

GetVolumes gets the volumes from --volume and --mount flags.

Returns a slice of Mounts to add to the runtime spec's list of mounts, the IDs of any images we mounted, a slice of bind-mounted paths, a slice of overlay directories and a slice of locks that we acquired, or an error.

The caller is expected to, after the command which uses the mounts and volumes exits, clean up the overlay directories, unmount and remove the mountpoints for the bind-mounted paths, unmount any images we mounted, and release the locks we returned (either using UnlockLockArray() or by iterating over them and unlocking them).

func UnlockLockArray added in v1.32.0

func UnlockLockArray(locks []*lockfile.LockFile)

UnlockLockArray is a helper for cleaning up after GetVolumes and the like.

Types

This section is empty.

Jump to

Keyboard shortcuts

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