diff options
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/libpod/options.go b/libpod/options.go index 10cb605c2..4c21a70c9 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -94,6 +94,20 @@ func WithSignaturePolicy(path string) RuntimeOption { } } +// WithInMemoryState specifies that the runtime will be backed by an in-memory +// state only, and state will not persist after the runtime is shut down +func WithInMemoryState() RuntimeOption { + return func(rt *Runtime) error { + if rt.valid { + return ErrRuntimeFinalized + } + + rt.config.InMemoryState = true + + return nil + } +} + // WithOCIRuntime specifies an OCI runtime to use for running containers func WithOCIRuntime(runtimePath string) RuntimeOption { return func(rt *Runtime) error { @@ -236,25 +250,6 @@ func WithNoPivotRoot(noPivot bool) RuntimeOption { // Container Creation Options -// WithRootFSFromPath uses the given path as a container's root filesystem -// No further setup is performed on this path -func WithRootFSFromPath(path string) CtrCreateOption { - return func(ctr *Container) error { - if ctr.valid { - return ErrCtrFinalized - } - - if ctr.config.RootfsDir != "" || ctr.config.RootfsImageID != "" || ctr.config.RootfsImageName != "" { - return errors.Wrapf(ErrInvalidArg, "container already configured with root filesystem") - } - - ctr.config.RootfsDir = path - ctr.config.RootfsFromImage = false - - return nil - } -} - // WithSELinuxMountLabel sets the mount label for SELinux func WithSELinuxMountLabel(mountLabel string) CtrCreateOption { return func(ctr *Container) error { @@ -277,14 +272,13 @@ func WithRootFSFromImage(imageID string, imageName string, useImageConfig bool) return ErrCtrFinalized } - if ctr.config.RootfsDir != "" || ctr.config.RootfsImageID != "" || ctr.config.RootfsImageName != "" { + if ctr.config.RootfsImageID != "" || ctr.config.RootfsImageName != "" { return errors.Wrapf(ErrInvalidArg, "container already configured with root filesystem") } ctr.config.RootfsImageID = imageID ctr.config.RootfsImageName = imageName ctr.config.UseImageConfig = useImageConfig - ctr.config.RootfsFromImage = true return nil } |