Merge pull request #33087 from Microsoft/jjh/blockreadonly

Windows: Block read-only
This commit is contained in:
Vincent Demeester 2017-05-10 17:21:33 +02:00 committed by GitHub
commit 6e0e283387
3 changed files with 22 additions and 0 deletions

View File

@ -79,6 +79,11 @@ func DecodeContainerConfig(src io.Reader) (*container.Config, *container.HostCon
return nil, nil, nil, err
}
// Validate ReadonlyRootfs
if err := validateReadonlyRootfs(hc); err != nil {
return nil, nil, nil, err
}
return w.Config, hc, w.NetworkingConfig, nil
}

View File

@ -103,3 +103,8 @@ func validateResources(hc *container.HostConfig, si *sysinfo.SysInfo) error {
func validatePrivileged(hc *container.HostConfig) error {
return nil
}
// validateReadonlyRootfs performs platform specific validation of the ReadonlyRootfs setting
func validateReadonlyRootfs(hc *container.HostConfig) error {
return nil
}

View File

@ -82,3 +82,15 @@ func validatePrivileged(hc *container.HostConfig) error {
}
return nil
}
// validateReadonlyRootfs performs platform specific validation of the ReadonlyRootfs setting
func validateReadonlyRootfs(hc *container.HostConfig) error {
// We may not be passed a host config, such as in the case of docker commit
if hc == nil {
return nil
}
if hc.ReadonlyRootfs {
return fmt.Errorf("invalid --read-only: Windows does not support this feature")
}
return nil
}