summaryrefslogtreecommitdiff
path: root/libpod/container_validate.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-05-12 13:35:56 -0400
committerGitHub <noreply@github.com>2022-05-12 13:35:56 -0400
commit81fc9f1deae7e92a298f3aee3a87cc4362123ea9 (patch)
treec54c4383181dd499f9e22334ca1ece71a20dabff /libpod/container_validate.go
parent45e9f1ff097adca65a5bb2a7367883508900667d (diff)
parent840c120c21124de921a7f57435cf0d0497103736 (diff)
downloadpodman-81fc9f1deae7e92a298f3aee3a87cc4362123ea9.tar.gz
podman-81fc9f1deae7e92a298f3aee3a87cc4362123ea9.tar.bz2
podman-81fc9f1deae7e92a298f3aee3a87cc4362123ea9.zip
Merge pull request #14159 from vrothberg/service-container
play kube: service container
Diffstat (limited to 'libpod/container_validate.go')
-rw-r--r--libpod/container_validate.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/container_validate.go b/libpod/container_validate.go
index c6c9a4c6d..d939c94e6 100644
--- a/libpod/container_validate.go
+++ b/libpod/container_validate.go
@@ -1,6 +1,8 @@
package libpod
import (
+ "fmt"
+
"github.com/containers/podman/v4/libpod/define"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
@@ -27,6 +29,12 @@ func (c *Container) validate() error {
return errors.Wrapf(define.ErrInvalidArg, "must set root filesystem source to either image or rootfs")
}
+ // A container cannot be marked as an infra and service container at
+ // the same time.
+ if c.IsInfra() && c.isService() {
+ return fmt.Errorf("cannot be infra and service container at the same time: %w", define.ErrInvalidArg)
+ }
+
// Cannot make a network namespace if we are joining another container's
// network namespace
if c.config.CreateNetNS && c.config.NetNsCtr != "" {