github.com/gdevillele/moby@v1.13.0/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/volume"
    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 lexographically 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 volume.MountPoint
    24  		if err := daemon.lazyInitializeVolume(c.ID, mount); err != nil {
    25  			return nil, err
    26  		}
    27  		s, err := mount.Setup(c.MountLabel, 0, 0)
    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 *volume.MountPoint) {
    46  	return
    47  }