lcow_parser.go 949 B

1234567891011121314151617181920212223242526272829303132333435
  1. package volume
  2. import (
  3. "errors"
  4. "fmt"
  5. "path"
  6. "github.com/docker/docker/api/types/mount"
  7. )
  8. var lcowSpecificValidators mountValidator = func(m *mount.Mount) error {
  9. if path.Clean(m.Target) == "/" {
  10. return fmt.Errorf("invalid specification: destination can't be '/'")
  11. }
  12. if m.Type == mount.TypeNamedPipe {
  13. return errors.New("Linux containers on Windows do not support named pipe mounts")
  14. }
  15. return nil
  16. }
  17. type lcowParser struct {
  18. windowsParser
  19. }
  20. func (p *lcowParser) validateMountConfig(mnt *mount.Mount) error {
  21. return p.validateMountConfigReg(mnt, rxLCOWDestination, lcowSpecificValidators)
  22. }
  23. func (p *lcowParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) {
  24. return p.parseMountRaw(raw, volumeDriver, rxLCOWDestination, false, lcowSpecificValidators)
  25. }
  26. func (p *lcowParser) ParseMountSpec(cfg mount.Mount) (*MountPoint, error) {
  27. return p.parseMountSpec(cfg, rxLCOWDestination, false, lcowSpecificValidators)
  28. }