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

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