diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-09-21 06:29:18 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-09-21 21:33:41 +0000 |
commit | 52c1365f32398b8ba0321c159e739a5416cd9ab2 (patch) | |
tree | 8a700c6cc35d1955e973d18b3ed537c380290334 /libpod | |
parent | 9e81f9daa4af9802088530a35a72814172430a36 (diff) | |
download | podman-52c1365f32398b8ba0321c159e739a5416cd9ab2.tar.gz podman-52c1365f32398b8ba0321c159e739a5416cd9ab2.tar.bz2 podman-52c1365f32398b8ba0321c159e739a5416cd9ab2.zip |
Add --mount option for `create` & `run` command
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #1524
Approved by: mheon
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal.go | 9 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index e5e871d6f..c88794212 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -926,6 +926,9 @@ func (c *Container) makeBindMounts() error { if err != nil { return errors.Wrapf(err, "error creating resolv.conf for container %s", c.ID()) } + if err = label.Relabel(newResolv, c.config.MountLabel, false); err != nil { + return errors.Wrapf(err, "error relabeling %q for container %q", newResolv, c.ID) + } c.state.BindMounts["/etc/resolv.conf"] = newResolv // Make /etc/hosts @@ -937,6 +940,9 @@ func (c *Container) makeBindMounts() error { if err != nil { return errors.Wrapf(err, "error creating hosts file for container %s", c.ID()) } + if err = label.Relabel(newHosts, c.config.MountLabel, false); err != nil { + return errors.Wrapf(err, "error relabeling %q for container %q", newHosts, c.ID) + } c.state.BindMounts["/etc/hosts"] = newHosts // Make /etc/hostname @@ -946,6 +952,9 @@ func (c *Container) makeBindMounts() error { if err != nil { return errors.Wrapf(err, "error creating hostname file for container %s", c.ID()) } + if err = label.Relabel(hostnamePath, c.config.MountLabel, false); err != nil { + return errors.Wrapf(err, "error relabeling %q for container %q", hostnamePath, c.ID) + } c.state.BindMounts["/etc/hostname"] = hostnamePath } diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index b77beaf64..553a612b3 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -283,6 +283,13 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { mounts := sortMounts(g.Mounts()) g.ClearMounts() for _, m := range mounts { + switch m.Type { + case "tmpfs", "devpts": + o := label.FormatMountLabel("", c.config.MountLabel) + if o != "" { + m.Options = append(m.Options, o) + } + } g.AddMount(m) } return g.Config, nil |