aboutsummaryrefslogtreecommitdiff
path: root/libpod/runtime_ctr.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/runtime_ctr.go')
-rw-r--r--libpod/runtime_ctr.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 58074cc43..5fb29abb5 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -1,6 +1,9 @@
package libpod
import (
+ "os"
+ "path/filepath"
+
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -54,6 +57,16 @@ func (r *Runtime) NewContainer(spec *spec.Spec, options ...CtrCreateOption) (c *
}
}()
+ if ctr.config.ShmDir == "" {
+ ctr.config.ShmDir = filepath.Join(ctr.bundlePath(), "shm")
+ if err := os.MkdirAll(ctr.config.ShmDir, 0700); err != nil {
+ if !os.IsExist(err) {
+ return nil, errors.Wrapf(err, "unable to create shm %q dir", ctr.config.ShmDir)
+ }
+ }
+ ctr.config.Mounts = append(ctr.config.Mounts, ctr.config.ShmDir)
+ }
+
// If the container is in a pod, add it to the pod
if ctr.pod != nil {
if err := ctr.pod.addContainer(ctr); err != nil {