github.com/rhatdan/docker@v0.7.7-0.20180119204836-47a0dcbcd20a/daemon/volumes_windows.go (about)

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