diff options
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go index b021b9f50..071b085e7 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1794,6 +1794,21 @@ func WithPidFile(pidFile string) CtrCreateOption { } } +// WithInitCtrType indicates the container is a initcontainer +func WithInitCtrType(containerType string) CtrCreateOption { + return func(ctr *Container) error { + if ctr.valid { + return define.ErrCtrFinalized + } + // Make sure the type is valid + if containerType == define.OneShotInitContainer || containerType == define.AlwaysInitContainer { + ctr.config.InitContainerType = containerType + return nil + } + return errors.Errorf("%s is invalid init container type", containerType) + } +} + // Pod Creation Options // WithInfraImage sets the infra image for libpod. |