config

package
v0.58.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 32 Imported by: 168

Documentation

Index

Constants

View Source
const (
	// OverrideContainersConfig holds the default config path overridden by the root user
	OverrideContainersConfig = "/etc/" + _configPath

	// DefaultContainersConfig holds the default containers config path
	DefaultContainersConfig = "/usr/share/" + _configPath

	// DefaultSignaturePolicyPath is the default value for the
	// policy.json file.
	DefaultSignaturePolicyPath = "/etc/containers/policy.json"
)
View Source
const (

	// CgroupfsCgroupsManager represents cgroupfs native cgroup manager.
	CgroupfsCgroupsManager = "cgroupfs"
	// DefaultApparmorProfile  specifies the default apparmor profile for the container.
	DefaultApparmorProfile = apparmor.Profile
	// DefaultHostsFile is the default path to the hosts file.
	DefaultHostsFile = "/etc/hosts"
	// SystemdCgroupsManager represents systemd native cgroup manager.
	SystemdCgroupsManager = "systemd"
	// DefaultLogSizeMax is the default value for the maximum log size
	// allowed for a container. Negative values mean that no limit is imposed.
	DefaultLogSizeMax = -1
	// DefaultEventsLogSize is the default value for the maximum events log size
	// before rotation.
	DefaultEventsLogSizeMax = uint64(1000000)
	// DefaultPidsLimit is the default value for maximum number of processes
	// allowed inside a container.
	DefaultPidsLimit = 2048
	// DefaultPullPolicy pulls the image if it does not exist locally.
	DefaultPullPolicy = "missing"
	// DefaultSubnet is the subnet that will be used for the default
	// network.
	DefaultSubnet = "10.88.0.0/16"
	// DefaultRootlessSignaturePolicyPath is the location within
	// XDG_CONFIG_HOME of the rootless policy.json file.
	DefaultRootlessSignaturePolicyPath = "containers/policy.json"
	// DefaultShmSize is the default upper limit on the size of tmpfs mounts.
	DefaultShmSize = "65536k"
	// DefaultUserNSSize indicates the default number of UIDs allocated for user namespace within a container.
	// Deprecated: no user of this field is known.
	DefaultUserNSSize = 65536
	// OCIBufSize limits maximum LogSizeMax.
	OCIBufSize = 8192
	// SeccompOverridePath if this exists it overrides the default seccomp path.
	SeccompOverridePath = _etcDir + "/containers/seccomp.json"
	// SeccompDefaultPath defines the default seccomp path.
	SeccompDefaultPath = _installPrefix + "/share/containers/seccomp.json"
	// DefaultVolumePluginTimeout is the default volume plugin timeout, in seconds
	DefaultVolumePluginTimeout = 5
)
View Source
const (
	// PodExitPolicyContinue instructs the pod to continue running when the
	// last container has exited.
	PodExitPolicyContinue PodExitPolicy = "continue"
	// PodExitPolicyStop instructs the pod to stop when the last container
	// has exited.
	PodExitPolicyStop = "stop"
	// PodExitPolicyUnsupported implies an internal error.
	// Negative for backwards compat.
	PodExitPolicyUnsupported = "invalid"
)
View Source
const (
	// DefaultLogDriver is the default type of log files
	DefaultLogDriver = "k8s-file"
)
View Source
const (

	// UserOverrideContainersConfig holds the containers config path overridden by the rootless user
	UserOverrideContainersConfig = ".config/" + _configPath
)

Variables

View Source
var (
	DefaultMaskedPaths = []string{
		"/proc/acpi",
		"/proc/kcore",
		"/proc/keys",
		"/proc/latency_stats",
		"/proc/sched_debug",
		"/proc/scsi",
		"/proc/timer_list",
		"/proc/timer_stats",
		"/sys/dev/block",
		"/sys/devices/virtual/powercap",
		"/sys/firmware",
		"/sys/fs/selinux",
	}

	DefaultReadOnlyPaths = []string{
		"/proc/asound",
		"/proc/bus",
		"/proc/fs",
		"/proc/irq",
		"/proc/sys",
		"/proc/sysrq-trigger",
	}

	// DefaultInfraImage is the default image to run as infrastructure containers in pods.
	DefaultInfraImage = ""
	// DefaultRootlessSHMLockPath is the default path for rootless SHM locks.
	DefaultRootlessSHMLockPath = "/libpod_rootless_lock"
	// DefaultDetachKeys is the default keys sequence for detaching a
	// container.
	DefaultDetachKeys = "ctrl-p,ctrl-q"
	// ErrConmonOutdated indicates the version of conmon found (whether via the configuration or $PATH)
	// is out of date for the current podman version.
	ErrConmonOutdated = errors.New("outdated conmon version")
	// ErrInvalidArg indicates that an invalid argument was passed.
	ErrInvalidArg = errors.New("invalid argument")
	// DefaultHooksDirs defines the default hooks directory.
	DefaultHooksDirs = []string{"/usr/share/containers/oci/hooks.d"}
	// DefaultCapabilities is the default for the default_capabilities option in the containers.conf file.
	DefaultCapabilities = []string{
		"CAP_CHOWN",
		"CAP_DAC_OVERRIDE",
		"CAP_FOWNER",
		"CAP_FSETID",
		"CAP_KILL",
		"CAP_NET_BIND_SERVICE",
		"CAP_SETFCAP",
		"CAP_SETGID",
		"CAP_SETPCAP",
		"CAP_SETUID",
		"CAP_SYS_CHROOT",
	}

	// Search these locations in which CNIPlugins can be installed.
	DefaultCNIPluginDirs = []string{
		"/usr/local/libexec/cni",
		"/usr/libexec/cni",
		"/usr/local/lib/cni",
		"/usr/lib/cni",
		"/opt/cni/bin",
	}
	DefaultNetavarkPluginDirs = []string{
		"/usr/local/libexec/netavark",
		"/usr/libexec/netavark",
		"/usr/local/lib/netavark",
		"/usr/lib/netavark",
	}
	DefaultSubnetPools = []SubnetPool{

		parseSubnetPool("10.89.0.0/16", 24),
		parseSubnetPool("10.90.0.0/15", 24),
		parseSubnetPool("10.92.0.0/14", 24),
		parseSubnetPool("10.96.0.0/11", 24),
		parseSubnetPool("10.128.0.0/9", 24),
	}
)
View Source
var DefaultInitPath = "/usr/libexec/podman/catatonit"

DefaultInitPath is the default path to the container-init binary.

PodExitPolicies includes the supported pod exit policies.

View Source
var ProxyEnv = []string{
	"http_proxy",
	"https_proxy",
	"ftp_proxy",
	"no_proxy",
	"HTTP_PROXY",
	"HTTPS_PROXY",
	"FTP_PROXY",
	"NO_PROXY",
}

ProxyEnv is a list of Proxy Environment variables

Functions

func Device

func Device(device string) (src, dst, permissions string, err error)

Device parses device mapping string to a src, dest & permissions string Valid values for device looklike:

'/dev/sdc"
'/dev/sdc:/dev/xvdc"
'/dev/sdc:/dev/xvdc:rwm"
'/dev/sdc:rm"

func EditConnectionConfig added in v0.58.0

func EditConnectionConfig(callback func(cfg *ConnectionsFile) error) error

EditConnectionConfig must be used to edit the connections config. The function will read and write the file automatically and the callback function just needs to modify the cfg as needed.

func IsValidDeviceMode

func IsValidDeviceMode(mode string) bool

IsValidDeviceMode checks if the mode for device is valid or not. IsValid mode is a composition of r (read), w (write), and m (mknod).

func ModuleDirectories added in v0.56.0

func ModuleDirectories() ([]string, error)

ModuleDirectories return the directories to load modules from: 1) XDG_CONFIG_HOME/HOME if rootless 2) /etc/ 3) /usr/share

func ValidateImageVolumeMode added in v0.49.0

func ValidateImageVolumeMode(mode string) error

Types

type Config

type Config struct {
	// Containers specify settings that configure how containers will run ont the system
	Containers ContainersConfig `toml:"containers"`
	// Engine specifies how the container engine based on Engine will run
	Engine EngineConfig `toml:"engine"`
	// Machine specifies configurations of podman machine VMs
	Machine MachineConfig `toml:"machine"`
	// Network section defines the configuration of CNI Plugins
	Network NetworkConfig `toml:"network"`
	// Secret section defines configurations for the secret management
	Secrets SecretConfig `toml:"secrets"`
	// ConfigMap section defines configurations for the configmaps management
	ConfigMaps ConfigMapConfig `toml:"configmaps"`
	// Farms defines configurations for the buildfarm farms
	Farms FarmConfig `toml:"farms"`
	// contains filtered or unexported fields
}

Config contains configuration options for container tools

func Default added in v0.2.0

func Default() (*Config, error)

Default returns the default container config. If no default config has been set yet, a new config will be loaded by New() and set as the default one. All callers are expected to use the returned Config read only. Changing data may impact other call sites.

func New

func New(options *Options) (*Config, error)

New returns a Config as described in the containers.conf(5) man page.

func NewConfig deprecated added in v0.0.4

func NewConfig(userConfigPath string) (*Config, error)

NewConfig creates a new Config. It starts with an empty config and, if specified, merges the config at `userConfigPath` path.

Deprecated: use new instead.

func Reload added in v0.14.7

func Reload() (*Config, error)

Reload clean the cached config and reloads the configuration from containers.conf files This function is meant to be used for long-running processes that need to reload potential changes made to the cached containers.conf files.

func (*Config) Capabilities added in v0.1.0

func (c *Config) Capabilities(user string, addCapabilities, dropCapabilities []string) ([]string, error)

Capabilities returns the capabilities parses the Add and Drop capability list from the default capabilities for the container

func (*Config) CgroupNS added in v0.8.0

func (c *Config) CgroupNS() string

CgroupNS returns the default Cgroup Namespace configuration to run containers with.

func (*Config) Cgroups added in v0.9.1

func (c *Config) Cgroups() string

Cgroups returns whether to run containers in their own control groups, as configured by the "cgroups" setting in containers.conf.

func (*Config) CheckCgroupsAndAdjustConfig added in v0.4.3

func (c *Config) CheckCgroupsAndAdjustConfig()

CheckCgroupsAndAdjustConfig checks if we're running rootless with the systemd cgroup manager. In case the user session isn't available, we're switching the cgroup manager to cgroupfs. Note, this only applies to rootless.

func (*Config) DNSOptions added in v0.8.0

func (c *Config) DNSOptions() []string

DNSOptions returns the default DNS options to add to resolv.conf in containers.

func (*Config) DNSSearches added in v0.8.0

func (c *Config) DNSSearches() []string

DNSSearches returns the default DNS searches to add to resolv.conf in containers.

func (*Config) DNSServers added in v0.8.0

func (c *Config) DNSServers() []string

DNSServers returns the default DNS servers to add to resolv.conf in containers.

func (*Config) DetachKeys added in v0.8.0

func (c *Config) DetachKeys() string

DetachKeys returns the default detach keys to detach from a container.

func (*Config) Devices added in v0.8.0

func (c *Config) Devices() []string

Devices returns the default additional devices for containers.

func (*Config) Env added in v0.8.0

func (c *Config) Env() []string

Env returns the default additional environment variables to add to containers.

func (*Config) FindConmon added in v0.0.4

func (c *Config) FindConmon() (string, error)

FindConmon iterates over (*Config).ConmonPath and returns the path to first (version) matching conmon binary. If non is found, we try to do a path lookup of "conmon".

func (*Config) FindConmonRs added in v0.50.0

func (c *Config) FindConmonRs() (string, error)

FindConmonRs iterates over (*Config).ConmonRsPath and returns the path to first (version) matching conmonrs binary. If non is found, we try to do a path lookup of "conmonrs".

func (*Config) FindHelperBinary added in v0.44.0

func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error)

FindHelperBinary will search the given binary name in the configured directories. If searchPATH is set to true it will also search in $PATH.

func (*Config) FindInitBinary added in v0.57.0

func (c *Config) FindInitBinary() (string, error)

FindInitBinary will return the path to the init binary (catatonit)

func (*Config) GetAllConnections added in v0.58.0

func (c *Config) GetAllConnections() ([]Connection, error)

GetAllConnections return all configured connections

func (*Config) GetAllFarms added in v0.58.0

func (c *Config) GetAllFarms() ([]Farm, error)

GetAllFarms returns all configured farms

func (*Config) GetConnection added in v0.58.0

func (c *Config) GetConnection(name string, def bool) (*Connection, error)

GetConnection return the connection for the given name or if def is set to true then return the default connection.

func (*Config) GetDefaultEnv added in v0.0.7

func (c *Config) GetDefaultEnv() []string

GetDefaultEnv returns the environment variables for the container. It will check the HTTPProxy and HostEnv booleans and add the appropriate environment variables to the container.

func (*Config) GetDefaultEnvEx added in v0.33.0

func (c *Config) GetDefaultEnvEx(envHost, httpProxy bool) []string

GetDefaultEnvEx returns the environment variables for the container. It will check the HTTPProxy and HostEnv boolean parameters and return the appropriate environment variables for the container.

func (*Config) GetDefaultFarmConnections added in v0.58.0

func (c *Config) GetDefaultFarmConnections() (string, []Connection, error)

GetDefaultFarmConnections returns the name of the default farm and the connections.

func (*Config) GetFarmConnections added in v0.58.0

func (c *Config) GetFarmConnections(name string) ([]Connection, error)

GetFarmConnections return all the connections for the given farm.

func (*Config) IPCNS added in v0.8.0

func (c *Config) IPCNS() string

IPCNS returns the default IPC Namespace configuration to run containers with.

func (*Config) ImageCopyTmpDir added in v0.45.0

func (c *Config) ImageCopyTmpDir() (string, error)

ImageCopyTmpDir default directory to store temporary image files during copy

func (*Config) LoadedModules added in v0.56.0

func (c *Config) LoadedModules() []string

LoadedModules returns absolute paths to loaded containers.conf modules.

func (*Config) LogDriver added in v0.33.2

func (c *Config) LogDriver() string

LogDriver returns the logging driver to be used currently k8s-file or journald.

func (*Config) MachineVolumes added in v0.48.0

func (c *Config) MachineVolumes() ([]string, error)

MachineVolumes returns volumes to mount into the VM.

func (*Config) Mounts added in v0.56.0

func (c *Config) Mounts() []string

Mounts returns the default set of mounts that should be mounted in containers.

func (*Config) NetNS added in v0.8.0

func (c *Config) NetNS() string

NetNS returns the default network namespace.

func (*Config) PidNS added in v0.8.0

func (c *Config) PidNS() string

PIDNS returns the default PID Namespace configuration to run containers with.

func (*Config) PidsLimit added in v0.8.0

func (c *Config) PidsLimit() int64

PidsLimit returns the default maximum number of pids to use in containers.

func (*Config) SecurityOptions added in v0.8.0

func (c *Config) SecurityOptions() []string

SecurityOptions returns the default security options.

func (*Config) ShmSize added in v0.8.0

func (c *Config) ShmSize() string

ShmSize returns the default size for temporary file systems to use in containers.

func (*Config) Sysctls added in v0.8.0

func (c *Config) Sysctls() []string

Sysctls returns the default sysctls to set in containers.

func (*Config) TZ added in v0.15.1

func (c *Config) TZ() string

TZ returns the timezone to set in containers.

func (*Config) UTSNS added in v0.8.0

func (c *Config) UTSNS() string

UTSNS returns the default UTS Namespace configuration to run containers with.

func (*Config) Ulimits added in v0.8.0

func (c *Config) Ulimits() []string

Ulimits returns the default ulimits to use in containers.

func (*Config) Umask added in v0.16.0

func (c *Config) Umask() string

func (*Config) Validate

func (c *Config) Validate() error

Validate is the main entry point for library configuration validation.

func (*Config) Volumes added in v0.8.0

func (c *Config) Volumes() []string

Volumes returns the default set of volumes that should be mounted in containers.

type ConfigMapConfig added in v0.47.0

type ConfigMapConfig struct {
	// Driver specifies the configmap driver to use.
	// Current valid value:
	//  * file
	//  * pass
	Driver string `toml:"driver,omitempty"`
	// Opts contains driver specific options
	Opts map[string]string `toml:"opts,omitempty"`
}

ConfigMapConfig represents the "configmap" TOML config table

revive does not like the name because the package is already called config

type Connection added in v0.58.0

type Connection struct {
	// Name of the connection
	Name string

	// Destination for this connection
	Destination

	// Default if this connection is the default
	Default bool

	// ReadWrite if true the connection is stored in the connections file
	ReadWrite bool
}

type ConnectionConfig added in v0.58.0

type ConnectionConfig struct {
	Default     string                 `json:",omitempty"`
	Connections map[string]Destination `json:",omitempty"`
}

type ConnectionsFile added in v0.58.0

type ConnectionsFile struct {
	Connection ConnectionConfig `json:",omitempty"`
	Farm       FarmConfig       `json:",omitempty"`
}

type ContainersConfig

type ContainersConfig struct {
	// Devices to add to all containers
	Devices attributedstring.Slice `toml:"devices,omitempty"`

	// Volumes to add to all containers
	Volumes attributedstring.Slice `toml:"volumes,omitempty"`

	// ApparmorProfile is the apparmor profile name which is used as the
	// default for the runtime.
	ApparmorProfile string `toml:"apparmor_profile,omitempty"`

	// Annotation to add to all containers
	Annotations attributedstring.Slice `toml:"annotations,omitempty"`

	// BaseHostsFile is the path to a hosts file, the entries from this file
	// are added to the containers hosts file. As special value "image" is
	// allowed which uses the /etc/hosts file from within the image and "none"
	// which uses no base file at all. If it is empty we should default
	// to /etc/hosts.
	BaseHostsFile string `toml:"base_hosts_file,omitempty"`

	// Default way to create a cgroup namespace for the container
	CgroupNS string `toml:"cgroupns,omitempty"`

	// Default cgroup configuration
	Cgroups string `toml:"cgroups,omitempty"`

	// CgroupConf entries specifies a list of cgroup files to write to and their values. For example
	// "memory.high=1073741824" sets the memory.high limit to 1GB.
	CgroupConf attributedstring.Slice `toml:"cgroup_conf,omitempty"`

	// Capabilities to add to all containers.
	DefaultCapabilities attributedstring.Slice `toml:"default_capabilities,omitempty"`

	// Sysctls to add to all containers.
	DefaultSysctls attributedstring.Slice `toml:"default_sysctls,omitempty"`

	// DefaultUlimits specifies the default ulimits to apply to containers
	DefaultUlimits attributedstring.Slice `toml:"default_ulimits,omitempty"`

	// DefaultMountsFile is the path to the default mounts file for testing
	DefaultMountsFile string `toml:"-"`

	// DNSServers set default DNS servers.
	DNSServers attributedstring.Slice `toml:"dns_servers,omitempty"`

	// DNSOptions set default DNS options.
	DNSOptions attributedstring.Slice `toml:"dns_options,omitempty"`

	// DNSSearches set default DNS search domains.
	DNSSearches attributedstring.Slice `toml:"dns_searches,omitempty"`

	// EnableKeyring tells the container engines whether to create
	// a kernel keyring for use within the container
	EnableKeyring bool `toml:"keyring,omitempty"`

	// EnableLabeling tells the container engines whether to use MAC
	// Labeling to separate containers (SELinux)
	EnableLabeling bool `toml:"label,omitempty"`

	// EnableLabeledUsers indicates whether to enforce confined users with
	// containers on SELinux systems. This option causes containers to
	// maintain the current user and role field of the calling process.
	// Otherwise containers run with user system_u, and the role system_r.
	EnableLabeledUsers bool `toml:"label_users,omitempty"`

	// Env is the environment variable list for container process.
	Env attributedstring.Slice `toml:"env,omitempty"`

	// EnvHost Pass all host environment variables into the container.
	EnvHost bool `toml:"env_host,omitempty"`

	// HostContainersInternalIP is used to set a specific host.containers.internal ip.
	HostContainersInternalIP string `toml:"host_containers_internal_ip,omitempty"`

	// HTTPProxy is the proxy environment variable list to apply to container process
	HTTPProxy bool `toml:"http_proxy,omitempty"`

	// Init tells container runtimes whether to run init inside the
	// container that forwards signals and reaps processes.
	Init bool `toml:"init,omitempty"`

	// InitPath is the path for init to run if the Init bool is enabled
	//
	// Deprecated: Do not use this field directly use conf.FindInitBinary() instead.
	InitPath string `toml:"init_path,omitempty"`

	// InterfaceName tells container runtimes how to set interface names
	// inside containers.
	// The only valid value at the moment is "device" that indicates the
	// interface name should be set as the network_interface name from
	// the network config.
	InterfaceName string `toml:"interface_name,omitempty"`

	// IPCNS way to create a ipc namespace for the container
	IPCNS string `toml:"ipcns,omitempty"`

	// LogDriver  for the container.  For example: k8s-file and journald
	LogDriver string `toml:"log_driver,omitempty"`

	// LogSizeMax is the maximum number of bytes after which the log file
	// will be truncated. It can be expressed as a human-friendly string
	// that is parsed to bytes.
	// Negative values indicate that the log file won't be truncated.
	LogSizeMax int64 `toml:"log_size_max,omitempty,omitzero"`

	// Specifies default format tag for container log messages.
	// This is useful for creating a specific tag for container log messages.
	// Containers logs default to truncated container ID as a tag.
	LogTag string `toml:"log_tag,omitempty"`

	// Mount to add to all containers
	Mounts attributedstring.Slice `toml:"mounts,omitempty"`

	// NetNS indicates how to create a network namespace for the container
	NetNS string `toml:"netns,omitempty"`

	// NoHosts tells container engine whether to create its own /etc/hosts
	NoHosts bool `toml:"no_hosts,omitempty"`

	// OOMScoreAdj tunes the host's OOM preferences for containers
	// (accepts values from -1000 to 1000).
	OOMScoreAdj *int `toml:"oom_score_adj,omitempty"`

	// PidsLimit is the number of processes each container is restricted to
	// by the cgroup process number controller.
	PidsLimit int64 `toml:"pids_limit,omitempty,omitzero"`

	// PidNS indicates how to create a pid namespace for the container
	PidNS string `toml:"pidns,omitempty"`

	// Copy the content from the underlying image into the newly created
	// volume when the container is created instead of when it is started.
	// If false, the container engine will not copy the content until
	// the container is started. Setting it to true may have negative
	// performance implications.
	PrepareVolumeOnCreate bool `toml:"prepare_volume_on_create,omitempty"`

	// Give extended privileges to all containers. A privileged container
	// turns off the security features that isolate the container from the
	// host. Dropped Capabilities, limited devices, read-only mount points,
	// Apparmor/SELinux separation, and Seccomp filters are all disabled.
	// Due to the disabled security features the privileged field should
	// almost never be set as containers can easily break out of
	// confinment.
	//
	// Containers running in a user namespace (e.g., rootless containers)
	// cannot have more privileges than the user that launched them.
	Privileged bool `toml:"privileged,omitempty"`

	// ReadOnly causes engine to run all containers with root file system mounted read-only
	ReadOnly bool `toml:"read_only,omitempty"`

	// SeccompProfile is the seccomp.json profile path which is used as the
	// default for the runtime.
	SeccompProfile string `toml:"seccomp_profile,omitempty"`

	// ShmSize holds the size of /dev/shm.
	ShmSize string `toml:"shm_size,omitempty"`

	// TZ sets the timezone inside the container
	TZ string `toml:"tz,omitempty"`

	// Umask is the umask inside the container.
	Umask string `toml:"umask,omitempty"`

	// UTSNS indicates how to create a UTS namespace for the container
	UTSNS string `toml:"utsns,omitempty"`

	// UserNS indicates how to create a User namespace for the container
	UserNS string `toml:"userns,omitempty"`

	// UserNSSize how many UIDs to allocate for automatically created UserNS
	// Deprecated: no user of this field is known.
	UserNSSize int `toml:"userns_size,omitempty,omitzero"`
}

ContainersConfig represents the "containers" TOML config table containers global options for containers tools

func (*ContainersConfig) Validate

func (c *ContainersConfig) Validate() error

Validate is the main entry point for containers configuration validation It returns an `error` on validation failure, otherwise `nil`.

type DBBackend added in v0.52.0

type DBBackend int

DBBackend determines which supported database backend Podman should use.

const (
	// Unsupported database backend.  Used as a sane base value for the type.
	DBBackendUnsupported DBBackend = iota
	// BoltDB backend.
	DBBackendBoltDB
	// SQLite backend.
	DBBackendSQLite

	// DBBackendDefault describes that no explicit backend has been set.
	// It should default to sqlite unless there is already an existing boltdb,
	// this allows for backwards compatibility on upgrades. The actual detection
	// logic must live in podman as we only know there were to look for the file.
	DBBackendDefault
)

func ParseDBBackend added in v0.52.0

func ParseDBBackend(raw string) (DBBackend, error)

ParseDBBackend parses the specified string into a DBBackend. An error is return for unsupported backends.

func (DBBackend) String added in v0.52.0

func (d DBBackend) String() string

String returns the DBBackend's string representation.

func (DBBackend) Validate added in v0.52.0

func (d DBBackend) Validate() error

Validate returns whether the DBBackend is supported.

type Destination added in v0.14.7

type Destination struct {
	// URI, required. Example: ssh://root@example.com:22/run/podman/podman.sock
	URI string `toml:"uri"`

	// Identity file with ssh key, optional
	Identity string `json:",omitempty" toml:"identity,omitempty"`

	// isMachine describes if the remote destination is a machine.
	IsMachine bool `json:",omitempty" toml:"is_machine,omitempty"`
}

Destination represents destination for remote service

type EngineConfig added in v0.5.0

type EngineConfig struct {
	// CgroupCheck indicates the configuration has been rewritten after an
	// upgrade to Fedora 31 to change the default OCI runtime for cgroupv2v2.
	CgroupCheck bool `toml:"cgroup_check,omitempty"`

	// CGroupManager is the CGroup Manager to use Valid values are "cgroupfs"
	// and "systemd".
	CgroupManager string `toml:"cgroup_manager,omitempty"`

	// ConmonEnvVars are environment variables to pass to the Conmon binary
	// when it is launched.
	ConmonEnvVars attributedstring.Slice `toml:"conmon_env_vars,omitempty"`

	// ConmonPath is the path to the Conmon binary used for managing containers.
	// The first path pointing to a valid file will be used.
	ConmonPath attributedstring.Slice `toml:"conmon_path,omitempty"`

	// ConmonRsPath is the path to the Conmon-rs binary used for managing containers.
	// The first path pointing to a valid file will be used.
	ConmonRsPath attributedstring.Slice `toml:"conmonrs_path,omitempty"`

	// CompatAPIEnforceDockerHub enforces using docker.io for completing
	// short names in Podman's compatibility REST API.  Note that this will
	// ignore unqualified-search-registries and short-name aliases defined
	// in containers-registries.conf(5).
	CompatAPIEnforceDockerHub bool `toml:"compat_api_enforce_docker_hub,omitempty"`

	// ComposeProviders specifies one or more external providers for the
	// compose command.  The first found provider is used for execution.
	// Can be an absolute and relative path or a (file) name.  Make sure to
	// expand the return items via `os.ExpandEnv`.
	ComposeProviders attributedstring.Slice `toml:"compose_providers,omitempty"`

	// ComposeWarningLogs emits logs on each invocation of the compose
	// command indicating that an external compose provider is being
	// executed.
	ComposeWarningLogs bool `toml:"compose_warning_logs,omitempty"`

	// DBBackend is the database backend to be used by Podman.
	DBBackend string `toml:"database_backend,omitempty"`

	// DetachKeys is the sequence of keys used to detach a container.
	DetachKeys string `toml:"detach_keys,omitempty"`

	// EnablePortReservation determines whether engine will reserve ports on the
	// host when they are forwarded to containers. When enabled, when ports are
	// forwarded to containers, they are held open by conmon as long as the
	// container is running, ensuring that they cannot be reused by other
	// programs on the host. However, this can cause significant memory usage if
	// a container has many ports forwarded to it. Disabling this can save
	// memory.
	EnablePortReservation bool `toml:"enable_port_reservation,omitempty"`

	// Environment variables to be used when running the container engine (e.g., Podman, Buildah). For example "http_proxy=internal.proxy.company.com"
	Env attributedstring.Slice `toml:"env,omitempty"`

	// EventsLogFilePath is where the events log is stored.
	EventsLogFilePath string `toml:"events_logfile_path,omitempty"`

	// EventsLogFileMaxSize sets the maximum size for the events log. When the limit is exceeded,
	// the logfile is rotated and the old one is deleted.
	EventsLogFileMaxSize eventsLogMaxSize `toml:"events_logfile_max_size,omitzero"`

	// EventsLogger determines where events should be logged.
	EventsLogger string `toml:"events_logger,omitempty"`

	// EventsContainerCreateInspectData creates a more verbose
	// container-create event which includes a JSON payload with detailed
	// information about the container.
	EventsContainerCreateInspectData bool `toml:"events_container_create_inspect_data,omitempty"`

	// HelperBinariesDir is a list of directories which are used to search for
	// helper binaries.
	HelperBinariesDir attributedstring.Slice `toml:"helper_binaries_dir,omitempty"`

	// configuration files. When the same filename is present in
	// multiple directories, the file in the directory listed last in
	// this slice takes precedence.
	HooksDir attributedstring.Slice `toml:"hooks_dir,omitempty"`

	// ImageBuildFormat (DEPRECATED) indicates the default image format to
	// building container images. Should use ImageDefaultFormat
	ImageBuildFormat string `toml:"image_build_format,omitempty"`

	// ImageDefaultTransport is the default transport method used to fetch
	// images.
	ImageDefaultTransport string `toml:"image_default_transport,omitempty"`

	// ImageParallelCopies indicates the maximum number of image layers
	// to be copied simultaneously. If this is zero, container engines
	// will fall back to containers/image defaults.
	ImageParallelCopies uint `toml:"image_parallel_copies,omitempty,omitzero"`

	// ImageDefaultFormat specified the manifest Type (oci, v2s2, or v2s1)
	// to use when pulling, pushing, building container images. By default
	// image pulled and pushed match the format of the source image.
	// Building/committing defaults to OCI.
	ImageDefaultFormat string `toml:"image_default_format,omitempty"`

	// ImageVolumeMode Tells container engines how to handle the built-in
	// image volumes.  Acceptable values are "bind", "tmpfs", and "ignore".
	ImageVolumeMode string `toml:"image_volume_mode,omitempty"`

	// InfraCommand is the command run to start up a pod infra container.
	InfraCommand string `toml:"infra_command,omitempty"`

	// InfraImage is the image a pod infra container will use to manage
	// namespaces.
	InfraImage string `toml:"infra_image,omitempty"`

	// InitPath is the path to the container-init binary.
	//
	// Deprecated: Do not use this field directly use conf.FindInitBinary() instead.
	InitPath string `toml:"init_path,omitempty"`

	// KubeGenerateType sets the Kubernetes kind/specification to generate by default
	// with the podman kube generate command
	KubeGenerateType string `toml:"kube_generate_type,omitempty"`

	// LockType is the type of locking to use.
	LockType string `toml:"lock_type,omitempty"`

	// MultiImageArchive - if true, the container engine allows for storing
	// archives (e.g., of the docker-archive transport) with multiple
	// images.  By default, Podman creates single-image archives.
	MultiImageArchive bool `toml:"multi_image_archive,omitempty"`

	// Namespace is the engine namespace to use. Namespaces are used to create
	// scopes to separate containers and pods in the state. When namespace is
	// set, engine will only view containers and pods in the same namespace. All
	// containers and pods created will default to the namespace set here. A
	// namespace of "", the empty string, is equivalent to no namespace, and all
	// containers and pods will be visible. The default namespace is "".
	Namespace string `toml:"namespace,omitempty"`

	// NetworkCmdPath is the path to the slirp4netns binary.
	NetworkCmdPath string `toml:"network_cmd_path,omitempty"`

	// NetworkCmdOptions is the default options to pass to the slirp4netns binary.
	// For example "allow_host_loopback=true"
	NetworkCmdOptions attributedstring.Slice `toml:"network_cmd_options,omitempty"`

	// NoPivotRoot sets whether to set no-pivot-root in the OCI runtime.
	NoPivotRoot bool `toml:"no_pivot_root,omitempty"`

	// NumLocks is the number of locks to make available for containers and
	// pods.
	NumLocks uint32 `toml:"num_locks,omitempty,omitzero"`

	// OCIRuntime is the OCI runtime to use.
	OCIRuntime string `toml:"runtime,omitempty"`

	// OCIRuntimes are the set of configured OCI runtimes (default is runc).
	OCIRuntimes map[string][]string `toml:"runtimes,omitempty"`

	// PlatformToOCIRuntime requests specific OCI runtime for a specified platform of image.
	PlatformToOCIRuntime map[string]string `toml:"platform_to_oci_runtime,omitempty"`

	// PodExitPolicy determines the behaviour when the last container of a pod exits.
	PodExitPolicy PodExitPolicy `toml:"pod_exit_policy,omitempty"`

	// PullPolicy determines whether to pull image before creating or running a container
	// default is "missing"
	PullPolicy string `toml:"pull_policy,omitempty"`

	// Indicates whether the application should be running in Remote mode
	Remote bool `toml:"remote,omitempty"`

	// Number of times to retry pulling/pushing images in case of failure
	Retry uint `toml:"retry,omitempty"`

	// Delay between retries in case pulling/pushing image fails
	// If set, container engines will retry at the set interval,
	// otherwise they delay 2 seconds and then exponentially back off.
	RetryDelay string `toml:"retry_delay,omitempty"`

	// RemoteURI is deprecated, see ActiveService
	// RemoteURI containers connection information used to connect to remote system.
	RemoteURI string `toml:"remote_uri,omitempty"`

	// RemoteIdentity is deprecated, ServiceDestinations
	// RemoteIdentity key file for RemoteURI
	RemoteIdentity string `toml:"remote_identity,omitempty"`

	// ActiveService index to Destinations added v2.0.3
	ActiveService string `toml:"active_service,omitempty"`

	// Add existing instances with requested compression algorithms to manifest list
	AddCompression attributedstring.Slice `toml:"add_compression,omitempty"`

	// ServiceDestinations mapped by service Names
	ServiceDestinations map[string]Destination `toml:"service_destinations,omitempty"`

	// SSHConfig contains the ssh config file path if not the default
	SSHConfig string `toml:"ssh_config,omitempty"`

	// RuntimePath is the path to OCI runtime binary for launching containers.
	// The first path pointing to a valid file will be used This is used only
	// when there are no OCIRuntime/OCIRuntimes defined.  It is used only to be
	// backward compatible with older versions of Podman.
	RuntimePath attributedstring.Slice `toml:"runtime_path,omitempty"`

	// RuntimeSupportsJSON is the list of the OCI runtimes that support
	// --format=json.
	RuntimeSupportsJSON attributedstring.Slice `toml:"runtime_supports_json,omitempty"`

	// RuntimeSupportsNoCgroups is a list of OCI runtimes that support
	// running containers without CGroups.
	RuntimeSupportsNoCgroups attributedstring.Slice `toml:"runtime_supports_nocgroup,omitempty"`

	// RuntimeSupportsKVM is a list of OCI runtimes that support
	// KVM separation for containers.
	RuntimeSupportsKVM attributedstring.Slice `toml:"runtime_supports_kvm,omitempty"`

	// SetOptions contains a subset of config options. It's used to indicate if
	// a given option has either been set by the user or by the parsed
	// configuration file. If not, the corresponding option might be
	// overwritten by values from the database. This behavior guarantees
	// backwards compat with older version of libpod and Podman.
	SetOptions

	// SignaturePolicyPath is the path to a signature policy to use for
	// validating images. If left empty, the containers/image default signature
	// policy will be used.
	SignaturePolicyPath string `toml:"-"`

	// SDNotify tells container engine to allow containers to notify the host systemd of
	// readiness using the SD_NOTIFY mechanism.
	SDNotify bool `toml:"-"`

	// ServiceTimeout is the number of seconds to wait without a connection
	// before the `podman system service` times out and exits
	ServiceTimeout uint `toml:"service_timeout,omitempty,omitzero"`

	// StaticDir is the path to a persistent directory to store container
	// files.
	StaticDir string `toml:"static_dir,omitempty"`

	// StopTimeout is the number of seconds to wait for container to exit
	// before sending kill signal.
	StopTimeout uint `toml:"stop_timeout,omitempty,omitzero"`

	// ExitCommandDelay is the number of seconds to wait for the exit
	// command to be send to the API process on the server.
	ExitCommandDelay uint `toml:"exit_command_delay,omitempty,omitzero"`

	// ImageCopyTmpDir is the default location for storing temporary
	// container image content,  Can be overridden with the TMPDIR
	// environment variable.  If you specify "storage", then the
	// location of the container/storage tmp directory will be used.
	ImageCopyTmpDir string `toml:"image_copy_tmp_dir,omitempty"`

	// TmpDir is the path to a temporary directory to store per-boot container
	// files. Must be stored in a tmpfs.
	TmpDir string `toml:"tmp_dir,omitempty"`

	// VolumePath is the default location that named volumes will be created
	// under. This convention is followed by the default volume driver, but
	// may not be by other drivers.
	VolumePath string `toml:"volume_path,omitempty"`

	// VolumePluginTimeout sets the default timeout, in seconds, for
	// operations that must contact a volume plugin. Plugins are external
	// programs accessed via REST API; this sets a timeout for requests to
	// that API.
	// A value of 0 is treated as no timeout.
	VolumePluginTimeout uint `toml:"volume_plugin_timeout,omitempty,omitzero"`

	// VolumePlugins is a set of plugins that can be used as the backend for
	// Podman named volumes. Each volume is specified as a name (what Podman
	// will refer to the plugin as) mapped to a path, which must point to a
	// Unix socket that conforms to the Volume Plugin specification.
	VolumePlugins map[string]string `toml:"volume_plugins,omitempty"`

	// ChownCopiedFiles tells the container engine whether to chown files copied
	// into a container to the container's primary uid/gid.
	ChownCopiedFiles bool `toml:"chown_copied_files,omitempty"`

	// CompressionFormat is the compression format used to compress image layers.
	CompressionFormat string `toml:"compression_format,omitempty"`

	// CompressionLevel is the compression level used to compress image layers.
	CompressionLevel *int `toml:"compression_level,omitempty"`

	// PodmanshTimeout is the number of seconds to wait for podmansh logins.
	// In other words, the timeout for the `podmansh` container to be in running
	// state.
	PodmanshTimeout uint `toml:"podmansh_timeout,omitempty,omitzero"`
	// contains filtered or unexported fields
}

EngineConfig contains configuration options used to set up a engine runtime

func (EngineConfig) EventsLogMaxSize added in v0.48.0

func (c EngineConfig) EventsLogMaxSize() uint64

func (*EngineConfig) ImagePlatformToRuntime added in v0.51.0

func (c *EngineConfig) ImagePlatformToRuntime(os string, arch string) string

Consumes container image's os and arch and returns if any dedicated runtime was configured otherwise returns default runtime.

func (*EngineConfig) Validate added in v0.5.0

func (c *EngineConfig) Validate() error

Validate is the main entry point for Engine configuration validation It returns an `error` on validation failure, otherwise `nil`.

type Farm added in v0.58.0

type Farm struct {
	// Name of the farm
	Name string

	// Connections
	Connections []string

	// Default if this is the default farm
	Default bool

	// ReadWrite if true the farm is stored in the connections file
	ReadWrite bool
}

type FarmConfig added in v0.56.0

type FarmConfig struct {
	// Default is the default farm to be used when farming out builds
	Default string `json:",omitempty" toml:"default,omitempty"`
	// List is a map of farms created where key=farm-name and value=list of connections
	List map[string][]string `json:",omitempty" toml:"list,omitempty"`
}

FarmConfig represents the "farm" TOML config tables

type MachineConfig added in v0.44.2

type MachineConfig struct {
	// Number of CPU's a machine is created with.
	CPUs uint64 `toml:"cpus,omitempty,omitzero"`
	// DiskSize is the size of the disk in GB created when init-ing a podman-machine VM
	DiskSize uint64 `toml:"disk_size,omitempty,omitzero"`
	// Image is the image used when init-ing a podman-machine VM
	Image string `toml:"image,omitempty"`
	// Memory in MB a machine is created with.
	Memory uint64 `toml:"memory,omitempty,omitzero"`
	// User to use for rootless podman when init-ing a podman machine VM
	User string `toml:"user,omitempty"`
	// Volumes are host directories mounted into the VM by default.
	Volumes attributedstring.Slice `toml:"volumes,omitempty"`
	// Provider is the virtualization provider used to run podman-machine VM
	Provider string `toml:"provider,omitempty"`
	// Rosetta is the flag to enable Rosetta in the podman-machine VM on Apple Silicon
	Rosetta bool `toml:"rosetta,omitempty"`
}

MachineConfig represents the "machine" TOML config table

func (*MachineConfig) URI added in v0.50.0

func (m *MachineConfig) URI() string

URI returns the URI Path to the machine image

type NetworkConfig

type NetworkConfig struct {
	// NetworkBackend determines what backend should be used for Podman's
	// networking.
	NetworkBackend string `toml:"network_backend,omitempty"`

	// CNIPluginDirs is where CNI plugin binaries are stored.
	CNIPluginDirs attributedstring.Slice `toml:"cni_plugin_dirs,omitempty"`

	// NetavarkPluginDirs is a list of directories which contain netavark plugins.
	NetavarkPluginDirs attributedstring.Slice `toml:"netavark_plugin_dirs,omitempty"`

	// FirewallDriver is the firewall driver to be used
	FirewallDriver string `toml:"firewall_driver,omitempty"`

	// DefaultNetwork is the network name of the default network
	// to attach pods to.
	DefaultNetwork string `toml:"default_network,omitempty"`

	// DefaultSubnet is the subnet to be used for the default network.
	// If a network with the name given in DefaultNetwork is not present
	// then a new network using this subnet will be created.
	// Must be a valid IPv4 CIDR block.
	DefaultSubnet string `toml:"default_subnet,omitempty"`

	// DefaultSubnetPools is a list of subnets and size which are used to
	// allocate subnets automatically for podman network create.
	// It will iterate through the list and will pick the first free subnet
	// with the given size. This is only used for ipv4 subnets, ipv6 subnets
	// are always assigned randomly.
	DefaultSubnetPools []SubnetPool `toml:"default_subnet_pools,omitempty"`

	// DefaultRootlessNetworkCmd is used to set the default rootless network
	// program, either "slirp4nents" (default) or "pasta".
	DefaultRootlessNetworkCmd string `toml:"default_rootless_network_cmd,omitempty"`

	// NetworkConfigDir is where network configuration files are stored.
	NetworkConfigDir string `toml:"network_config_dir,omitempty"`

	// DNSBindPort is the port that should be used by dns forwarding daemon
	// for netavark rootful bridges with dns enabled. This can be necessary
	// when other dns forwarders run on the machine. 53 is used if unset.
	DNSBindPort uint16 `toml:"dns_bind_port,omitempty,omitzero"`

	// PastaOptions contains a default list of pasta(1) options that should
	// be used when running pasta.
	PastaOptions attributedstring.Slice `toml:"pasta_options,omitempty"`
}

NetworkConfig represents the "network" TOML config table

func (*NetworkConfig) Validate

func (c *NetworkConfig) Validate() error

Validate is the main entry point for network configuration validation. The parameter `onExecution` specifies if the validation should include execution checks. It returns an `error` on validation failure, otherwise `nil`.

type Options added in v0.56.0

type Options struct {
	// Attempt to load the following config modules.
	Modules []string

	// Set the loaded config as the default one which can later on be
	// accessed via Default().
	SetDefault bool
	// contains filtered or unexported fields
}

Options to use when loading a Config via New().

type PodExitPolicy added in v0.48.0

type PodExitPolicy string

PodExitPolicy determines a pod's exit and stop behaviour.

func ParsePodExitPolicy added in v0.48.0

func ParsePodExitPolicy(policy string) (PodExitPolicy, error)

ParsePodExitPolicy parses the specified policy and returns an error if it is invalid.

type PullPolicy added in v0.4.3

type PullPolicy int

PullPolicy determines how and which images are being pulled from a container registry (i.e., docker transport only).

Supported string values are: * "always" <-> PullPolicyAlways * "missing" <-> PullPolicyMissing * "newer" <-> PullPolicyNewer * "never" <-> PullPolicyNever

const (
	// Always pull the image and throw an error if the pull fails.
	PullPolicyAlways PullPolicy = iota
	// Pull the image only if it could not be found in the local containers
	// storage.  Throw an error if no image could be found and the pull fails.
	PullPolicyMissing
	// Never pull the image but use the one from the local containers
	// storage.  Throw an error if no image could be found.
	PullPolicyNever
	// Pull if the image on the registry is newer than the one in the local
	// containers storage.  An image is considered to be newer when the
	// digests are different.  Comparing the time stamps is prone to
	// errors.  Pull errors are suppressed if a local image was found.
	PullPolicyNewer

	// Ideally this should be the first `ioata` but backwards compatibility
	// prevents us from changing the values.
	PullPolicyUnsupported = -1
)

func ParsePullPolicy added in v0.38.0

func ParsePullPolicy(s string) (PullPolicy, error)

ParsePullPolicy parses the string into a pull policy.

Supported string values are: * "always" <-> PullPolicyAlways * "missing" <-> PullPolicyMissing (also "ifnotpresent" and "") * "newer" <-> PullPolicyNewer (also "ifnewer") * "never" <-> PullPolicyNever

func ValidatePullPolicy deprecated added in v0.4.3

func ValidatePullPolicy(s string) (PullPolicy, error)

Deprecated: please use `ParsePullPolicy` instead.

func (PullPolicy) String added in v0.38.0

func (p PullPolicy) String() string

String converts a PullPolicy into a string.

Supported string values are: * "always" <-> PullPolicyAlways * "missing" <-> PullPolicyMissing * "newer" <-> PullPolicyNewer * "never" <-> PullPolicyNever

func (PullPolicy) Validate added in v0.38.0

func (p PullPolicy) Validate() error

Validate returns if the pull policy is not supported.

type SecretConfig added in v0.40.0

type SecretConfig struct {
	// Driver specifies the secret driver to use.
	// Current valid value:
	//  * file
	//  * pass
	Driver string `toml:"driver,omitempty"`
	// Opts contains driver specific options
	Opts map[string]string `toml:"opts,omitempty"`
}

SecretConfig represents the "secret" TOML config table

type SetOptions added in v0.0.4

type SetOptions struct {
	// StorageConfigRunRootSet indicates if the RunRoot has been explicitly set
	// by the config or by the user. It's required to guarantee backwards
	// compatibility with older versions of libpod for which we must query the
	// database configuration. Not included in the on-disk config.
	StorageConfigRunRootSet bool `toml:"-"`

	// StorageConfigGraphRootSet indicates if the RunRoot has been explicitly
	// set by the config or by the user. It's required to guarantee backwards
	// compatibility with older versions of libpod for which we must query the
	// database configuration. Not included in the on-disk config.
	StorageConfigGraphRootSet bool `toml:"-"`

	// StorageConfigGraphDriverNameSet indicates if the GraphDriverName has been
	// explicitly set by the config or by the user. It's required to guarantee
	// backwards compatibility with older versions of libpod for which we must
	// query the database configuration. Not included in the on-disk config.
	StorageConfigGraphDriverNameSet bool `toml:"-"`
}

SetOptions contains a subset of options in a Config. It's used to indicate if a given option has either been set by the user or by a parsed engine configuration file. If not, the corresponding option might be overwritten by values from the database. This behavior guarantees backwards compat with older version of libpod and Podman.

type SubnetPool added in v0.48.0

type SubnetPool struct {
	// Base is a bigger subnet which will be used to allocate a subnet with
	// the given size.
	Base *types.IPNet `toml:"base,omitempty"`
	// Size is the CIDR for the new subnet. It must be equal or small
	// than the CIDR from the base subnet.
	Size int `toml:"size,omitempty"`
}

Jump to

Keyboard shortcuts

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