archive_unix.go 964 B

1234567891011121314151617181920212223242526272829303132
  1. //go:build !windows
  2. // +build !windows
  3. package daemon // import "github.com/docker/docker/daemon"
  4. import (
  5. "github.com/docker/docker/container"
  6. volumemounts "github.com/docker/docker/volume/mounts"
  7. )
  8. // checkIfPathIsInAVolume checks if the path is in a volume. If it is, it
  9. // cannot be in a read-only volume. If it is not in a volume, the container
  10. // cannot be configured with a read-only rootfs.
  11. func checkIfPathIsInAVolume(container *container.Container, absPath string) (bool, error) {
  12. var toVolume bool
  13. parser := volumemounts.NewParser()
  14. for _, mnt := range container.MountPoints {
  15. if toVolume = parser.HasResource(mnt, absPath); toVolume {
  16. if mnt.RW {
  17. break
  18. }
  19. return false, ErrVolumeReadonly
  20. }
  21. }
  22. return toVolume, nil
  23. }
  24. // isOnlineFSOperationPermitted returns an error if an online filesystem operation
  25. // is not permitted.
  26. func (daemon *Daemon) isOnlineFSOperationPermitted(container *container.Container) error {
  27. return nil
  28. }