summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-09-13 17:33:07 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-09-21 19:06:12 +0000
commit09f506930c1c585b12e9ad89044528da23d2851a (patch)
tree54494746c618a4597d4c2a57299879565b1aaa6c /pkg/spec
parent4f42fe2e9e35a01181031ddca07c044647d7bf04 (diff)
downloadpodman-09f506930c1c585b12e9ad89044528da23d2851a.tar.gz
podman-09f506930c1c585b12e9ad89044528da23d2851a.tar.bz2
podman-09f506930c1c585b12e9ad89044528da23d2851a.zip
Don't mount /dev/shm if the user told you --ipc=none
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1466 Approved by: mheon
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/createconfig.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 518ea5731..a9c7d2967 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -112,8 +112,7 @@ type CreateConfig struct {
Quiet bool //quiet
ReadOnlyRootfs bool //read-only
Resources CreateResourceConfig
- Rm bool //rm
- ShmDir string
+ Rm bool //rm
StopSignal syscall.Signal // stop-signal
StopTimeout uint // stop-timeout
Sysctl map[string]string //sysctl
@@ -447,7 +446,16 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib
options = append(options, libpod.WithConmonPidFile(c.ConmonPidFile))
options = append(options, libpod.WithLabels(c.Labels))
options = append(options, libpod.WithUser(c.User))
- options = append(options, libpod.WithShmDir(c.ShmDir))
+ if c.IpcMode.IsHost() {
+ options = append(options, libpod.WithShmDir("/dev/shm"))
+
+ } else if c.IpcMode.IsContainer() {
+ ctr, err := runtime.LookupContainer(c.IpcMode.Container())
+ if err != nil {
+ return nil, errors.Wrapf(err, "container %q not found", c.IpcMode.Container())
+ }
+ options = append(options, libpod.WithShmDir(ctr.ShmDir()))
+ }
options = append(options, libpod.WithShmSize(c.Resources.ShmSize))
options = append(options, libpod.WithGroups(c.GroupAdd))
options = append(options, libpod.WithIDMappings(*c.IDMappings))