archive_unix.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. "github.com/docker/docker/errdefs"
  7. volumemounts "github.com/docker/docker/volume/mounts"
  8. "github.com/pkg/errors"
  9. )
  10. // checkIfPathIsInAVolume checks if the path is in a volume. If it is, it
  11. // cannot be in a read-only volume. If it is not in a volume, the container
  12. // cannot be configured with a read-only rootfs.
  13. func checkIfPathIsInAVolume(container *container.Container, absPath string) (bool, error) {
  14. var toVolume bool
  15. parser := volumemounts.NewParser()
  16. for _, mnt := range container.MountPoints {
  17. if toVolume = parser.HasResource(mnt, absPath); toVolume {
  18. if mnt.RW {
  19. break
  20. }
  21. return false, errdefs.InvalidParameter(errors.New("mounted volume is marked read-only"))
  22. }
  23. }
  24. return toVolume, nil
  25. }
  26. // isOnlineFSOperationPermitted returns an error if an online filesystem operation
  27. // is not permitted.
  28. func (daemon *Daemon) isOnlineFSOperationPermitted(container *container.Container) error {
  29. return nil
  30. }