github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/daemon/archive_windows.go (about)

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