Sfoglia il codice sorgente

Better error when --host=ipc but no /dev/mqueue

Signed-off-by: Burke Libbey <burke.libbey@shopify.com>
Burke Libbey 9 anni fa
parent
commit
fd955ce6ca
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      daemon/container_unix.go

+ 6 - 0
daemon/container_unix.go

@@ -217,6 +217,12 @@ func populateCommand(c *Container, env []string) error {
 	} else {
 	} else {
 		ipc.HostIpc = c.hostConfig.IpcMode.IsHost()
 		ipc.HostIpc = c.hostConfig.IpcMode.IsHost()
 		if ipc.HostIpc {
 		if ipc.HostIpc {
+			if _, err := os.Stat("/dev/shm"); err != nil {
+				return fmt.Errorf("/dev/shm is not mounted, but must be for --host=ipc")
+			}
+			if _, err := os.Stat("/dev/mqueue"); err != nil {
+				return fmt.Errorf("/dev/mqueue is not mounted, but must be for --host=ipc")
+			}
 			c.ShmPath = "/dev/shm"
 			c.ShmPath = "/dev/shm"
 			c.MqueuePath = "/dev/mqueue"
 			c.MqueuePath = "/dev/mqueue"
 		}
 		}