archive_unix.go 531 B

12345678910111213141516171819
  1. // +build !windows
  2. package daemon
  3. // checkIfPathIsInAVolume checks if the path is in a volume. If it is, it
  4. // cannot be in a read-only volume. If it is not in a volume, the container
  5. // cannot be configured with a read-only rootfs.
  6. func checkIfPathIsInAVolume(container *Container, absPath string) (bool, error) {
  7. var toVolume bool
  8. for _, mnt := range container.MountPoints {
  9. if toVolume = mnt.HasResource(absPath); toVolume {
  10. if mnt.RW {
  11. break
  12. }
  13. return false, ErrVolumeReadonly
  14. }
  15. }
  16. return toVolume, nil
  17. }