github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/daemon/volumes_windows.go (about)

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