diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-09-13 17:12:23 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2018-09-14 13:28:19 -0400 |
commit | 31294799c473da400914cf1b4e2e845757f5be0c (patch) | |
tree | 0bb14da9f54be4b8b44f800551b61bcfe135a1f8 | |
parent | 2188d8f7ada15caddd8b721745a0a4b6f61ce111 (diff) | |
download | podman-31294799c473da400914cf1b4e2e845757f5be0c.tar.gz podman-31294799c473da400914cf1b4e2e845757f5be0c.tar.bz2 podman-31294799c473da400914cf1b4e2e845757f5be0c.zip |
Don't mount /dev/* if user mounted /dev
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-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) } |