summaryrefslogtreecommitdiff
path: root/libpod/container_validate.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-08-05 13:52:15 +0000
committerGitHub <noreply@github.com>2021-08-05 13:52:15 +0000
commit1f0a24437d71f8fe2b2233a428202afcfe513666 (patch)
treee17f57dce6bf61d38a74fc6b8f011bffbb4082fa /libpod/container_validate.go
parent117583c293713f2baa920c4035e820ad59fe6622 (diff)
parent3c3fa6fac4d0f8e89181ea2d4e1fe0318d24b6f4 (diff)
downloadpodman-1f0a24437d71f8fe2b2233a428202afcfe513666.tar.gz
podman-1f0a24437d71f8fe2b2233a428202afcfe513666.tar.bz2
podman-1f0a24437d71f8fe2b2233a428202afcfe513666.zip
Merge pull request #11011 from baude/initcontainers
implement init containers in podman
Diffstat (limited to 'libpod/container_validate.go')
-rw-r--r--libpod/container_validate.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpod/container_validate.go b/libpod/container_validate.go
index 6ff46f1b1..91ebe93fb 100644
--- a/libpod/container_validate.go
+++ b/libpod/container_validate.go
@@ -131,5 +131,11 @@ func (c *Container) validate() error {
if c.config.User == "" && (c.config.Spec.Process.User.UID != 0 || c.config.Spec.Process.User.GID != 0) {
return errors.Wrapf(define.ErrInvalidArg, "please set User explicitly via WithUser() instead of in OCI spec directly")
}
+
+ // Init-ctrs must be used inside a Pod. Check if a init container type is
+ // passed and if no pod is passed
+ if len(c.config.InitContainerType) > 0 && len(c.config.Pod) < 1 {
+ return errors.Wrap(define.ErrInvalidArg, "init containers must be created in a pod")
+ }
return nil
}