daemon/volumes_windows.go
ba1725a9
 // +build windows
 
 package daemon
 
bd9814f0
 import (
a793564b
 	"fmt"
63efc120
 	"sort"
 
6bb0d181
 	"github.com/docker/docker/container"
a7e686a7
 	"github.com/docker/docker/volume"
bd9814f0
 )
81fa9feb
 
a7e686a7
 // setupMounts configures the mount points for a container by appending each
8af4f89c
 // of the configured mounts on the container to the OCI mount structure
 // which will ultimately be passed into the oci runtime during container creation.
a7e686a7
 // It also ensures each of the mounts are lexographically sorted.
94d70d83
 
 // BUGBUG TODO Windows containerd. This would be much better if it returned
 // an array of windowsoci mounts, not container mounts. Then no need to
 // do multiple transitions.
 
 func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, error) {
 	var mnts []container.Mount
 	for _, mount := range c.MountPoints { // type is volume.MountPoint
 		if err := daemon.lazyInitializeVolume(c.ID, mount); err != nil {
aab35963
 			return nil, err
2aa673ae
 		}
a7e686a7
 		// If there is no source, take it from the volume path
 		s := mount.Source
 		if s == "" && mount.Volume != nil {
 			s = mount.Volume.Path()
 		}
 		if s == "" {
a793564b
 			return nil, fmt.Errorf("No source for mount name '%s' driver %q destination '%s'", mount.Name, mount.Driver, mount.Destination)
a7e686a7
 		}
94d70d83
 		mnts = append(mnts, container.Mount{
a7e686a7
 			Source:      s,
 			Destination: mount.Destination,
 			Writable:    mount.RW,
 		})
 	}
 
 	sort.Sort(mounts(mnts))
 	return mnts, nil
b9e4b957
 }
71eadd41
 
a7e686a7
 // setBindModeIfNull is platform specific processing which is a no-op on
 // Windows.
 func setBindModeIfNull(bind *volume.MountPoint) *volume.MountPoint {
 	return bind
 }