archive_windows.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package daemon
  2. import (
  3. "errors"
  4. containertypes "github.com/docker/docker/api/types/container"
  5. "github.com/docker/docker/container"
  6. )
  7. // checkIfPathIsInAVolume checks if the path is in a volume. If it is, it
  8. // cannot be in a read-only volume. If it is not in a volume, the container
  9. // cannot be configured with a read-only rootfs.
  10. //
  11. // This is a no-op on Windows which does not support read-only volumes, or
  12. // extracting to a mount point inside a volume. TODO Windows: FIXME Post-TP5
  13. func checkIfPathIsInAVolume(container *container.Container, absPath string) (bool, error) {
  14. return false, nil
  15. }
  16. // isOnlineFSOperationPermitted returns an error if an online filesystem operation
  17. // is not permitted (such as stat or for copying). Running Hyper-V containers
  18. // cannot have their file-system interrogated from the host as the filter is
  19. // loaded inside the utility VM, not the host.
  20. // IMPORTANT: The container lock must NOT be held when calling this function.
  21. func (daemon *Daemon) isOnlineFSOperationPermitted(container *container.Container) error {
  22. if !container.IsRunning() {
  23. return nil
  24. }
  25. // Determine isolation. If not specified in the hostconfig, use daemon default.
  26. actualIsolation := container.HostConfig.Isolation
  27. if containertypes.Isolation.IsDefault(containertypes.Isolation(actualIsolation)) {
  28. actualIsolation = daemon.defaultIsolation
  29. }
  30. if containertypes.Isolation.IsHyperV(actualIsolation) {
  31. return errors.New("filesystem operations against a running Hyper-V container are not supported")
  32. }
  33. return nil
  34. }