From 7989e422b404c2fe182dac5154fbfe218c561b93 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 8 May 2020 13:25:41 -0400 Subject: Fix `podman pod create --infra=false` We were accidentally setting incorrect defaults for the network namespace for rootless `pod create` when infra containers were not being created. This should resolve that issue. Signed-off-by: Matthew Heon --- cmd/podman/pods/create.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go index f97fa836a..e24cdef98 100644 --- a/cmd/podman/pods/create.go +++ b/cmd/podman/pods/create.go @@ -16,6 +16,7 @@ import ( "github.com/containers/libpod/pkg/specgen" "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -81,6 +82,7 @@ func create(cmd *cobra.Command, args []string) error { } if !createOptions.Infra { + logrus.Debugf("Not creating an infra container") if cmd.Flag("infra-command").Changed { return errors.New("cannot set infra-command without an infra container") } @@ -114,6 +116,7 @@ func create(cmd *cobra.Command, args []string) error { if err != nil { return err } + createOptions.Net.Network = specgen.Namespace{} if cmd.Flag("network").Changed { netInput, err := cmd.Flags().GetString("network") if err != nil { @@ -132,6 +135,7 @@ func create(cmd *cobra.Command, args []string) error { n.NSMode = specgen.Bridge createOptions.Net.CNINetworks = strings.Split(netInput, ",") } + createOptions.Net.Network = n } if len(createOptions.Net.PublishPorts) > 0 { if !createOptions.Infra { -- cgit v1.2.3-54-g00ecf