diff --git a/container/container_unix.go b/container/container_unix.go index 22c7544179..d784a4f137 100644 --- a/container/container_unix.go +++ b/container/container_unix.go @@ -559,18 +559,6 @@ func (container *Container) UnmountIpcMounts(unmount func(pth string) error) { } } - if !container.HasMountFor("/dev/mqueue") { - mqueuePath, err := container.MqueueResourcePath() - if err != nil { - logrus.Error(err) - warnings = append(warnings, err.Error()) - } else if mqueuePath != "" { - if err := unmount(mqueuePath); err != nil { - warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", mqueuePath, err)) - } - } - } - if len(warnings) > 0 { logrus.Warnf("failed to cleanup ipc mounts:\n%v", strings.Join(warnings, "\n")) } @@ -589,9 +577,8 @@ func (container *Container) IpcMounts() []execdriver.Mount { Propagation: volume.DefaultPropagationMode, }) } - - if !container.HasMountFor("/dev/mqueue") { - label.SetFileLabel(container.MqueuePath, container.MountLabel) + if !container.HasMountFor("/dev/mqueue") && + container.MqueuePath != "" { mounts = append(mounts, execdriver.Mount{ Source: container.MqueuePath, Destination: "/dev/mqueue", diff --git a/daemon/container_operations_unix.go b/daemon/container_operations_unix.go index 1a54566dad..27fdd30a84 100644 --- a/daemon/container_operations_unix.go +++ b/daemon/container_operations_unix.go @@ -93,11 +93,6 @@ func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro return err } - c.MqueuePath, err = c.MqueueResourcePath() - if err != nil { - return err - } - if c.HostConfig.IpcMode.IsContainer() { ic, err := daemon.getIpcContainer(c) if err != nil { @@ -105,7 +100,6 @@ func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro } ipc.ContainerID = ic.ID c.ShmPath = ic.ShmPath - c.MqueuePath = ic.MqueuePath } else { ipc.HostIpc = c.HostConfig.IpcMode.IsHost() if ipc.HostIpc { @@ -1062,21 +1056,6 @@ func (daemon *Daemon) setupIpcDirs(c *container.Container) error { } } - if !c.HasMountFor("/dev/mqueue") { - mqueuePath, err := c.MqueueResourcePath() - if err != nil { - return err - } - - if err := idtools.MkdirAllAs(mqueuePath, 0700, rootUID, rootGID); err != nil { - return err - } - - if err := syscall.Mount("mqueue", mqueuePath, "mqueue", uintptr(syscall.MS_NOEXEC|syscall.MS_NOSUID|syscall.MS_NODEV), ""); err != nil { - return fmt.Errorf("mounting mqueue mqueue : %s", err) - } - } - return nil } diff --git a/daemon/execdriver/native/template/default_template_linux.go b/daemon/execdriver/native/template/default_template_linux.go index 7e7fe28fac..073bcac9a3 100644 --- a/daemon/execdriver/native/template/default_template_linux.go +++ b/daemon/execdriver/native/template/default_template_linux.go @@ -64,6 +64,12 @@ func New() *configs.Config { Flags: syscall.MS_NOSUID | syscall.MS_NOEXEC, Data: "newinstance,ptmxmode=0666,mode=0620,gid=5", }, + { + Source: "mqueue", + Destination: "/dev/mqueue", + Device: "mqueue", + Flags: defaultMountFlags, + }, { Source: "sysfs", Destination: "/sys",