volumes_windows.go 1.3 KB

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