diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-09-14 17:26:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-14 17:26:38 -0400 |
commit | 5622de9c617f3324e915fdb950dee9bf0d268d47 (patch) | |
tree | b92e1d30f116b26aa3c3da6c2ea5f591949ad55e /pkg | |
parent | 8b21e2ecf5b0ffd81c35dc8a3831bf99585695be (diff) | |
parent | 31294799c473da400914cf1b4e2e845757f5be0c (diff) | |
download | podman-5622de9c617f3324e915fdb950dee9bf0d268d47.tar.gz podman-5622de9c617f3324e915fdb950dee9bf0d268d47.tar.bz2 podman-5622de9c617f3324e915fdb950dee9bf0d268d47.zip |
Merge pull request #1467 from rhatdan/dev
Don't mount /dev/* if user mounted /dev
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/spec/spec.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index cc3501e1e..5757a36fe 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -318,8 +318,18 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint for _, mount := range mounts { destinations[path.Clean(mount.Destination)] = true } + + // Copy all mounts from spec to defaultMounts, except for + // - mounts overridden by a user supplied mount; + // - all mounts under /dev if a user supplied /dev is present; + mountDev := destinations["/dev"] for _, mount := range configSpec.Mounts { if _, ok := destinations[path.Clean(mount.Destination)]; !ok { + if mountDev && strings.HasPrefix(mount.Destination, "/dev/") { + // filter out everything under /dev if /dev is user-mounted + continue + } + logrus.Debugf("Adding mount %s", mount.Destination) mounts = append(mounts, mount) } |