فهرست منبع

remove host directory check

Signed-off-by: Akhil Mohan <akhil.mohan@mayadata.io>
Akhil Mohan 5 سال پیش
والد
کامیت
86ebbe16de
2فایلهای تغییر یافته به همراه0 افزوده شده و 20 حذف شده
  1. 0 15
      daemon/container.go
  2. 0 5
      daemon/oci_linux.go

+ 0 - 15
daemon/container.go

@@ -276,21 +276,6 @@ func validateHostConfig(hostConfig *containertypes.HostConfig, platform string)
 		return nil
 	}
 
-	if hostConfig.Privileged {
-		for _, deviceMapping := range hostConfig.Devices {
-			if deviceMapping.PathOnHost == deviceMapping.PathInContainer {
-				continue
-			}
-			if _, err := os.Stat(deviceMapping.PathInContainer); err != nil {
-				if os.IsNotExist(err) {
-					continue
-				}
-				return errors.Wrap(err, "error stating device path in container")
-			}
-			return errors.Errorf("container device path: %s must be different from any host device path for privileged mode containers", deviceMapping.PathInContainer)
-		}
-	}
-
 	if hostConfig.AutoRemove && !hostConfig.RestartPolicy.IsNone() {
 		return errors.Errorf("can't create 'AutoRemove' container with restart policy")
 	}

+ 0 - 5
daemon/oci_linux.go

@@ -826,11 +826,6 @@ func WithDevices(daemon *Daemon, c *container.Container) coci.SpecOpts {
 					logrus.WithField("container", c.ID).Warnf("path in container %s already exists in privileged mode", deviceMapping.PathInContainer)
 					continue
 				}
-				// check if the path exists in the container. need to create a device only if the
-				// path does not exists.
-				if _, err := os.Stat(deviceMapping.PathInContainer); !os.IsNotExist(err) {
-					return errors.Errorf("container device path: %s must be different from any host device path for privileged mode containers", deviceMapping.PathInContainer)
-				}
 				d, _, err := oci.DevicesFromPath(deviceMapping.PathOnHost, deviceMapping.PathInContainer, "rwm")
 				if err != nil {
 					return err