1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/volumes_windows.go
Anusha Ragunathan b15264004d Add missing call to "VolumeDriver.Mount" during container start.
On container start, volume mounts are setup which should include
invoking "VolumeDriver.Mount" to setup necessary mounts. This was
missing for Windows containers. Fix that.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-09-19 14:40:45 -07:00

47 lines
1.3 KiB
Go

// +build windows
package daemon
import (
"sort"
"github.com/docker/docker/container"
"github.com/docker/docker/volume"
)
// setupMounts configures the mount points for a container by appending each
// of the configured mounts on the container to the OCI mount structure
// which will ultimately be passed into the oci runtime during container creation.
// It also ensures each of the mounts are lexographically sorted.
// 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 {
return nil, err
}
s, err := mount.Setup(c.MountLabel, 0, 0)
if err != nil {
return nil, err
}
mnts = append(mnts, container.Mount{
Source: s,
Destination: mount.Destination,
Writable: mount.RW,
})
}
sort.Sort(mounts(mnts))
return mnts, nil
}
// setBindModeIfNull is platform specific processing which is a no-op on
// Windows.
func setBindModeIfNull(bind *volume.MountPoint) {
return
}