container

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoEnableFakeroot

func AutoEnableFakeroot(lastImg string, writable bool, currentFakeroot bool) bool

AutoEnableFakeroot checks if fakeroot should be auto-enabled for writable .img overlays Returns the updated fakeroot setting

func BindPaths

func BindPaths(paths ...string) []string

BindPaths collects all directories suitable for --bind flags. Deduplication and child path filtering is handled by DeduplicateBindPaths().

func BuildPathEnv

func BuildPathEnv(overlays []string) string

BuildPathEnv constructs the PATH environment variable based on overlays

func CollectOverlayEnv

func CollectOverlayEnv(paths []string) (map[string]string, map[string]string)

CollectOverlayEnv reads .env files from overlay paths and returns environment configs and notes

func DeduplicateBindPaths

func DeduplicateBindPaths(paths []string) []string

DeduplicateBindPaths resolves, deduplicates, and filters child paths from bind directories. It handles formats: "/path", "/path:/container", "/path:/container:ro"

func DetectGPUFlags

func DetectGPUFlags() []string

DetectGPUFlags inspects the host for GPU support and returns the necessary apptainer flags.

func FormatOverlayMount

func FormatOverlayMount(path string, writable bool) string

FormatOverlayMount formats an overlay path with the appropriate :ro or :rw suffix

func InstalledOverlays

func InstalledOverlays() (map[string]string, error)

InstalledOverlays scans all image search paths and returns a mapping from normalized overlay names to their absolute file path. Searches user → scratch → legacy → system directories. First match wins (user overlays shadow system ones).

func ResolveOverlayPaths

func ResolveOverlayPaths(inputs []string) ([]string, error)

ResolveOverlayPaths coerces user input into absolute overlay paths that exist on disk.

Types

type SetupConfig

type SetupConfig struct {
	Overlays       []string // Overlay paths (will be resolved)
	WritableImg    bool     // Whether .img overlays should be writable
	EnvSettings    []string // User-specified environment variables (KEY=VALUE format)
	BindPaths      []string // User-specified bind paths
	Fakeroot       bool     // Whether to use fakeroot
	ApptainerFlags []string // Additional apptainer flags to pass through
}

SetupConfig holds all configuration needed to set up a container

type SetupResult

type SetupResult struct {
	Overlays       []string          // Resolved and ordered overlay paths
	OverlayArgs    []string          // Overlay paths with :ro/:rw suffixes
	EnvList        []string          // Complete environment variable list
	EnvNotes       map[string]string // Environment variable notes for display
	BindPaths      []string          // Deduplicated bind paths
	Fakeroot       bool              // Final fakeroot setting (may be auto-enabled)
	ApptainerFlags []string          // Apptainer flags including GPU flags
	LastImg        string            // Path to .img overlay if present
}

SetupResult contains all the processed configuration ready for container execution

func Setup

func Setup(cfg SetupConfig) (*SetupResult, error)

Setup processes all container configuration and returns a ready-to-use result

Jump to

Keyboard shortcuts

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