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:
parent
35b9e6989f
commit
86ebbe16de
2 changed files with 0 additions and 20 deletions
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue