Преглед на файлове

Use container.HostConfig.ShmSize directly

It was noted[1] that container's HostConfig.ShmSize, if not set, should be
initialized to daemon default value during container creation.

In fact, it is already done in daemon.adaptContainerSettings, so we can use
value from container.HostConfig directly.

[1] https://github.com/moby/moby/pull/34087#discussion_r128656429

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Kir Kolyshkin преди 8 години
родител
ревизия
0fb1fb1ce0
променени са 1 файла, в които са добавени 1 реда и са изтрити 5 реда
  1. 1 5
      daemon/container_operations_unix.go

+ 1 - 5
daemon/container_operations_unix.go

@@ -120,11 +120,7 @@ func (daemon *Daemon) setupIpcDirs(c *container.Container) error {
 				return err
 				return err
 			}
 			}
 
 
-			shmSize := int64(daemon.configStore.ShmSize)
-			if c.HostConfig.ShmSize != 0 {
-				shmSize = c.HostConfig.ShmSize
-			}
-			shmproperty := "mode=1777,size=" + strconv.FormatInt(shmSize, 10)
+			shmproperty := "mode=1777,size=" + strconv.FormatInt(c.HostConfig.ShmSize, 10)
 			if err := unix.Mount("shm", shmPath, "tmpfs", uintptr(unix.MS_NOEXEC|unix.MS_NOSUID|unix.MS_NODEV), label.FormatMountLabel(shmproperty, c.GetMountLabel())); err != nil {
 			if err := unix.Mount("shm", shmPath, "tmpfs", uintptr(unix.MS_NOEXEC|unix.MS_NOSUID|unix.MS_NODEV), label.FormatMountLabel(shmproperty, c.GetMountLabel())); err != nil {
 				return fmt.Errorf("mounting shm tmpfs: %s", err)
 				return fmt.Errorf("mounting shm tmpfs: %s", err)
 			}
 			}