1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

remove host directory check

Signed-off-by: Akhil Mohan <akhil.mohan@mayadata.io>
This commit is contained in:
Akhil Mohan 2020-01-02 14:28:51 +05:30
parent 35b9e6989f
commit 86ebbe16de
No known key found for this signature in database
GPG key ID: 391F159C7531BD86
2 changed files with 0 additions and 20 deletions

View file

@ -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")
}

View file

@ -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