volumes_windows.go 1.3 KB

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