Documentation ¶
Index ¶
- Constants
- type ContainerFilter
- type CopyOptions
- type CtrCreateOption
- func WithAnnotations(annotations map[string]string) CtrCreateOption
- func WithLabels(labels map[string]string) CtrCreateOption
- func WithName(name string) CtrCreateOption
- func WithPod(pod *pod.Pod) CtrCreateOption
- func WithRootFSFromImage(image string, useImageConfig bool) CtrCreateOption
- func WithRootFSFromPath(path string) CtrCreateOption
- func WithSharedNamespaces(from *ctr.Container, namespaces map[string]string) CtrCreateOption
- func WithStopSignal(signal uint) CtrCreateOption
- type ImageFilter
- type PodFilter
- type Runtime
- func (r *Runtime) GetConfig() *RuntimeConfig
- func (r *Runtime) GetContainer(id string) (*ctr.Container, error)
- func (r *Runtime) GetContainers(filters ...ContainerFilter) ([]*ctr.Container, error)
- func (r *Runtime) GetImage(image string) (*storage.Image, error)
- func (r *Runtime) GetImages(filter ...ImageFilter) ([]*storage.Image, error)
- func (r *Runtime) GetPod(id string) (*pod.Pod, error)
- func (r *Runtime) GetPods(filters ...PodFilter) ([]*pod.Pod, error)
- func (r *Runtime) ImportImage(path string) (*storage.Image, error)
- func (r *Runtime) LookupContainer(idOrName string) (*ctr.Container, error)
- func (r *Runtime) LookupPod(idOrName string) (*pod.Pod, error)
- func (r *Runtime) NewContainer(spec *spec.Spec, options ...CtrCreateOption) (*ctr.Container, error)
- func (r *Runtime) NewPod() (*pod.Pod, error)
- func (r *Runtime) PullImage(imgName string, allTags bool, reportWriter io.Writer) error
- func (r *Runtime) PushImage(source string, destination string, options CopyOptions, reportWriter io.Writer) error
- func (r *Runtime) RemoveContainer(c *ctr.Container, force bool) error
- func (r *Runtime) RemoveImage(image *storage.Image) error
- func (r *Runtime) RemovePod(p *pod.Pod, force bool) error
- func (r *Runtime) Shutdown(force bool) error
- func (r *Runtime) TagImage(image *storage.Image, tag string) error
- func (r *Runtime) UntagImage(image *storage.Image, tag string) error
- type RuntimeConfig
- type RuntimeOption
- func WithCgroupManager(manager string) RuntimeOption
- func WithConmonEnv(environment []string) RuntimeOption
- func WithConmonPath(path string) RuntimeOption
- func WithImageConfig(defaultTransport string, insecureRegistries, registries []string) RuntimeOption
- func WithOCIRuntime(runtimePath string) RuntimeOption
- func WithPidsLimit(limit int64) RuntimeOption
- func WithSELinux() RuntimeOption
- func WithSignaturePolicy(path string) RuntimeOption
- func WithStorageConfig(config storage.StoreOptions) RuntimeOption
Constants ¶
const ( // IPCNamespace represents the IPC namespace IPCNamespace = "ipc" // MountNamespace represents the mount namespace MountNamespace = "mount" // NetNamespace represents the network namespace NetNamespace = "net" // PIDNamespace represents the PID namespace PIDNamespace = "pid" // UserNamespace represents the user namespace UserNamespace = "user" // UTSNamespace represents the UTS namespace UTSNamespace = "uts" )
const ( // DefaultRegistry is a prefix that we apply to an image name // to check docker hub first for the image DefaultRegistry = "docker://" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainerFilter ¶
ContainerFilter is a function to determine whether a container is included in command output. Containers to be outputted are tested using the function. A true return will include the container, a false return will exclude it.
type CopyOptions ¶
type CopyOptions struct { // Compression specifies the type of compression which is applied to // layer blobs. The default is to not use compression, but // archive.Gzip is recommended. Compression archive.Compression // DockerRegistryOptions encapsulates settings that affect how we // connect or authenticate to a remote registry to which we want to // push the image. common.DockerRegistryOptions // SigningOptions encapsulates settings that control whether or not we // strip or add signatures to the image when pushing (uploading) the // image to a registry. common.SigningOptions }
CopyOptions contains the options given when pushing or pulling images
type CtrCreateOption ¶
A CtrCreateOption is a functional option which alters the Container created by NewContainer
func WithAnnotations ¶
func WithAnnotations(annotations map[string]string) CtrCreateOption
WithAnnotations adds annotations to the pod
func WithLabels ¶
func WithLabels(labels map[string]string) CtrCreateOption
WithLabels adds labels to the pod
func WithRootFSFromImage ¶
func WithRootFSFromImage(image string, useImageConfig bool) CtrCreateOption
WithRootFSFromImage sets up a fresh root filesystem using the given image If useImageConfig is specified, image volumes, environment variables, and other configuration from the image will be added to the config
func WithRootFSFromPath ¶
func WithRootFSFromPath(path string) CtrCreateOption
WithRootFSFromPath uses the given path as a container's root filesystem No further setup is performed on this path
func WithSharedNamespaces ¶
func WithSharedNamespaces(from *ctr.Container, namespaces map[string]string) CtrCreateOption
WithSharedNamespaces sets a container to share namespaces with another container. If the from container belongs to a pod, the new container will be added to the pod. By default no namespaces are shared. To share a namespace, add the Namespace string constant to the map as a key
func WithStopSignal ¶
func WithStopSignal(signal uint) CtrCreateOption
WithStopSignal sets the signal that will be sent to stop the container
type ImageFilter ¶
ImageFilter is a function to determine whether an image is included in command output. Images to be outputted are tested using the function. A true return will include the image, a false return will exclude it.
type PodFilter ¶
PodFilter is a function to determine whether a pod is included in command output. Pods to be outputted are tested using the function. A true return will include the pod, a false return will exclude it.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is the core libpod runtime
func NewRuntime ¶
func NewRuntime(options ...RuntimeOption) (*Runtime, error)
NewRuntime creates a new container runtime Options can be passed to override the default configuration for the runtime
func (*Runtime) GetConfig ¶
func (r *Runtime) GetConfig() *RuntimeConfig
GetConfig returns a copy of the configuration used by the runtime
func (*Runtime) GetContainer ¶
GetContainer retrieves a container by its ID
func (*Runtime) GetContainers ¶
func (r *Runtime) GetContainers(filters ...ContainerFilter) ([]*ctr.Container, error)
GetContainers retrieves all containers from the state Filters can be provided which will determine what containers are included in the output. Multiple filters are handled by ANDing their output, so only containers matching all filters are returned
func (*Runtime) GetImage ¶
GetImage retrieves an image matching the given name or hash from system storage If no matching image can be found, an error is returned
func (*Runtime) GetImages ¶
func (r *Runtime) GetImages(filter ...ImageFilter) ([]*storage.Image, error)
GetImages retrieves all images present in storage Filters can be provided which will determine which images are included in the output. Multiple filters are handled by ANDing their output, so only images matching all filters are included
func (*Runtime) GetPods ¶
GetPods retrieves all pods Filters can be provided which will determine which pods are included in the output. Multiple filters are handled by ANDing their output, so only pods matching all filters are returned
func (*Runtime) ImportImage ¶
ImportImage imports an OCI format image archive into storage as an image
func (*Runtime) LookupContainer ¶
LookupContainer looks up a container by its name or a partial ID If a partial ID is not unique, an error will be returned
func (*Runtime) LookupPod ¶
LookupPod retrieves a pod by its name or a partial ID If a partial ID is not unique, an error will be returned
func (*Runtime) NewContainer ¶
NewContainer creates a new container from a given OCI config
func (*Runtime) PullImage ¶
PullImage pulls an image from configured registries By default, only the latest tag (or a specific tag if requested) will be pulled. If allTags is true, all tags for the requested image will be pulled. Signature validation will be performed if the Runtime has been appropriately configured
func (*Runtime) PushImage ¶
func (r *Runtime) PushImage(source string, destination string, options CopyOptions, reportWriter io.Writer) error
PushImage pushes the given image to a location described by the given path
func (*Runtime) RemoveContainer ¶
RemoveContainer removes the given container If force is specified, the container will be stopped first Otherwise, RemoveContainer will return an error if the container is running
func (*Runtime) RemoveImage ¶
RemoveImage deletes an image from local storage Images being used by running containers cannot be removed
func (*Runtime) RemovePod ¶
RemovePod removes a pod and all containers in it If force is specified, all containers in the pod will be stopped first Otherwise, RemovePod will return an error if any container in the pod is running Remove acts atomically, removing all containers or no containers
func (*Runtime) Shutdown ¶
Shutdown shuts down the runtime and associated containers and storage If force is true, containers and mounted storage will be shut down before cleaning up; if force is false, an error will be returned if there are still containers running or mounted
type RuntimeConfig ¶
type RuntimeConfig struct { StorageConfig storage.StoreOptions ImageDefaultTransport string InsecureRegistries []string Registries []string SignaturePolicyPath string RuntimePath string ConmonPath string ConmonEnvVars []string CgroupManager string SelinuxEnabled bool PidsLimit int64 }
RuntimeConfig contains configuration options used to set up the runtime
type RuntimeOption ¶
A RuntimeOption is a functional option which alters the Runtime created by NewRuntime
func WithCgroupManager ¶
func WithCgroupManager(manager string) RuntimeOption
WithCgroupManager specifies the manager implementation name which is used to handle cgroups for containers
func WithConmonEnv ¶
func WithConmonEnv(environment []string) RuntimeOption
WithConmonEnv specifies the environment variable list for the conmon process
func WithConmonPath ¶
func WithConmonPath(path string) RuntimeOption
WithConmonPath specifies the path to the conmon binary which manages the runtime
func WithImageConfig ¶
func WithImageConfig(defaultTransport string, insecureRegistries, registries []string) RuntimeOption
WithImageConfig uses the given configuration to set up image handling If this is not specified, the system default configuration will be used instead
func WithOCIRuntime ¶
func WithOCIRuntime(runtimePath string) RuntimeOption
WithOCIRuntime specifies an OCI runtime to use for running containers
func WithPidsLimit ¶
func WithPidsLimit(limit int64) RuntimeOption
WithPidsLimit specifies the maximum number of processes each container is restricted to
func WithSELinux ¶
func WithSELinux() RuntimeOption
WithSELinux enables SELinux on the container server
func WithSignaturePolicy ¶
func WithSignaturePolicy(path string) RuntimeOption
WithSignaturePolicy specifies the path of a file which decides how trust is managed for images we've pulled. If this is not specified, the system default configuration will be used instead
func WithStorageConfig ¶
func WithStorageConfig(config storage.StoreOptions) RuntimeOption
WithStorageConfig uses the given configuration to set up container storage If this is not specified, the system default configuration will be used instead