archive_unix.go 586 B

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