github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/daemon/volumes_windows.go (about)

     1  // +build windows
     2  
     3  package daemon
     4  
     5  import (
     6  	"sort"
     7  
     8  	"github.com/docker/docker/api/types/mount"
     9  	"github.com/docker/docker/container"
    10  	"github.com/docker/docker/pkg/idtools"
    11  	"github.com/docker/docker/volume"
    12  )
    13  
    14  // setupMounts configures the mount points for a container by appending each
    15  // of the configured mounts on the container to the OCI mount structure
    16  // which will ultimately be passed into the oci runtime during container creation.
    17  // It also ensures each of the mounts are lexicographically sorted.
    18  
    19  // BUGBUG TODO Windows containerd. This would be much better if it returned
    20  // an array of runtime spec mounts, not container mounts. Then no need to
    21  // do multiple transitions.
    22  
    23  func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, error) {
    24  	var mnts []container.Mount
    25  	for _, mount := range c.MountPoints { // type is volume.MountPoint
    26  		if err := daemon.lazyInitializeVolume(c.ID, mount); err != nil {
    27  			return nil, err
    28  		}
    29  		s, err := mount.Setup(c.MountLabel, idtools.IDPair{0, 0}, nil)
    30  		if err != nil {
    31  			return nil, err
    32  		}
    33  
    34  		mnts = append(mnts, container.Mount{
    35  			Source:      s,
    36  			Destination: mount.Destination,
    37  			Writable:    mount.RW,
    38  		})
    39  	}
    40  
    41  	sort.Sort(mounts(mnts))
    42  	return mnts, nil
    43  }
    44  
    45  // setBindModeIfNull is platform specific processing which is a no-op on
    46  // Windows.
    47  func setBindModeIfNull(bind *volume.MountPoint) {
    48  	return
    49  }
    50  
    51  func (daemon *Daemon) validateBindDaemonRoot(m mount.Mount) (bool, error) {
    52  	return false, nil
    53  }