summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate/container_create.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-04-24 10:46:30 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2020-04-24 10:48:40 +0200
commit36039a38ea8463c31c14ce52c38f22cc93e72ede (patch)
tree53255df403f067b4892e861fe74dde7070acc26d /pkg/specgen/generate/container_create.go
parent81c7a2444cb5cbf8b8911cdb59446a239f89168c (diff)
downloadpodman-36039a38ea8463c31c14ce52c38f22cc93e72ede.tar.gz
podman-36039a38ea8463c31c14ce52c38f22cc93e72ede.tar.bz2
podman-36039a38ea8463c31c14ce52c38f22cc93e72ede.zip
create: move validate after setting default ns
validate the configuration only after we set the default namespaces. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/specgen/generate/container_create.go')
-rw-r--r--pkg/specgen/generate/container_create.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 1be77d315..369c64e1f 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -15,9 +15,6 @@ import (
// MakeContainer creates a container based on the SpecGenerator
func MakeContainer(rt *libpod.Runtime, s *specgen.SpecGenerator) (*libpod.Container, error) {
- if err := s.Validate(); err != nil {
- return nil, errors.Wrap(err, "invalid config provided")
- }
rtc, err := rt.GetConfig()
if err != nil {
return nil, err
@@ -94,6 +91,10 @@ func MakeContainer(rt *libpod.Runtime, s *specgen.SpecGenerator) (*libpod.Contai
options = append(options, libpod.WithRootFSFromImage(newImage.ID(), s.Image, s.RawImageName))
+ if err := s.Validate(); err != nil {
+ return nil, errors.Wrap(err, "invalid config provided")
+ }
+
runtimeSpec, err := SpecGenToOCI(s, rt, newImage)
if err != nil {
return nil, err