diff options
-rw-r--r-- | cmd/podman/common/create.go | 3 | ||||
-rw-r--r-- | cmd/podman/common/specgen.go | 10 | ||||
-rw-r--r-- | cmd/podman/containers/create.go | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index bdf762ed7..e5ee76390 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -394,8 +394,9 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet { "security-opt", containerConfig.SecurityOptions(), "Security Options", ) + shmSize := "" createFlags.StringVar( - &cf.ShmSize, + &shmSize, "shm-size", containerConfig.ShmSize(), "Size of /dev/shm "+sizeWithUnitFormat, ) diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 10ae0bb2d..994c5367e 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -403,11 +403,13 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string } // SHM Size - shmSize, err := units.FromHumanSize(c.ShmSize) - if err != nil { - return errors.Wrapf(err, "unable to translate --shm-size") + if c.ShmSize != "" { + shmSize, err := units.FromHumanSize(c.ShmSize) + if err != nil { + return errors.Wrapf(err, "unable to translate --shm-size") + } + s.ShmSize = &shmSize } - s.ShmSize = &shmSize s.HostAdd = c.Net.AddHosts s.UseImageResolvConf = c.Net.UseImageResolvConf s.DNSServers = c.Net.DNSServers diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index 8c0e40122..f8a7c07ef 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -131,6 +131,10 @@ func createInit(c *cobra.Command) error { logrus.Warn("setting security options with --privileged has no effect") } + if c.Flag("shm-size").Changed { + cliVals.ShmSize = c.Flag("shm-size").Value.String() + } + if (c.Flag("dns").Changed || c.Flag("dns-opt").Changed || c.Flag("dns-search").Changed) && (cliVals.Net.Network.NSMode == specgen.NoNetwork || cliVals.Net.Network.IsContainer()) { return errors.Errorf("conflicting options: dns and the network mode.") } |