Documentation
¶
Index ¶
- func CreatePersistentNamespace(targetPath string, pid int, nsType Type) error
- func DefaultRootlessMaps() ([]IDMap, []IDMap)
- func GetCurrentNamespace(nsType Type) (string, error)
- func IsRootless() bool
- func JoinNamespace(nsType Type, path string) error
- func NamespacePath(pid int, nsType Type) string
- func ParseCapability(cap string) string
- func SetDomainname(domainname string) error
- func SetHostname(hostname string) error
- func Supported(nsType Type) bool
- type Config
- type IDMap
- type Manager
- func (m *Manager) CreateNamespaces(containerID string, cfg *Config) (*NamespacePaths, error)
- func (m *Manager) DeletePersistentNamespace(containerID string) error
- func (m *Manager) GetPIDForContainer(containerID string) (int, error)
- func (m *Manager) SetupUserNamespace(pid int, cfg *Config) error
- func (m *Manager) TargetPath(containerID string, nsType Type) string
- type NamespacePaths
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePersistentNamespace ¶
CreatePersistentNamespace creates a persistent bind-mount of a namespace.
func DefaultRootlessMaps ¶
DefaultRootlessMaps returns default UID/GID mappings for rootless mode.
func GetCurrentNamespace ¶
GetCurrentNamespace gets the current namespace inode for a given type.
func IsRootless ¶
func IsRootless() bool
IsRootless checks if the current process is running as non-root.
func JoinNamespace ¶
JoinNamespace joins an existing namespace.
func NamespacePath ¶
NamespacePath returns the path to a namespace file for a given PID.
func ParseCapability ¶
ParseCapability validates and normalizes a Linux capability name.
func SetDomainname ¶
SetDomainname sets the domainname for a UTS namespace.
func SetHostname ¶
SetHostname sets the hostname for a UTS namespace.
Types ¶
type Config ¶
type Config struct {
User bool
Mount bool
PID bool
Net bool
UTS bool
IPC bool
Cgroup bool
// User namespace configuration.
UIDMappings []IDMap
GIDMappings []IDMap
// UTS configuration.
Hostname string
Domainname string
// Rootless mode.
Rootless bool
}
Config holds the configuration for creating namespaces.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages Linux namespaces for containers.
func (*Manager) CreateNamespaces ¶
func (m *Manager) CreateNamespaces(containerID string, cfg *Config) (*NamespacePaths, error)
CreateNamespaces creates namespaces for a container.
func (*Manager) DeletePersistentNamespace ¶
DeletePersistentNamespace removes a persistent namespace.
func (*Manager) GetPIDForContainer ¶
GetPIDForContainer retrieves the init PID for a container.
func (*Manager) SetupUserNamespace ¶
SetupUserNamespace sets up the user namespace with UID/GID mappings.