volumes_windows.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package daemon // import "github.com/docker/docker/daemon"
  2. import (
  3. "sort"
  4. "github.com/docker/docker/api/types/mount"
  5. "github.com/docker/docker/container"
  6. "github.com/docker/docker/pkg/idtools"
  7. volumemounts "github.com/docker/docker/volume/mounts"
  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 volumemounts.MountPoint
  19. if err := daemon.lazyInitializeVolume(c.ID, mount); err != nil {
  20. return nil, err
  21. }
  22. s, err := mount.Setup(c.MountLabel, idtools.Identity{}, 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 *volumemounts.MountPoint) {
  38. return
  39. }
  40. func (daemon *Daemon) validateBindDaemonRoot(m mount.Mount) (bool, error) {
  41. return false, nil
  42. }