2018-02-05 16:05:59 -05:00
|
|
|
package volume // import "github.com/docker/docker/volume"
|
2017-08-01 13:32:44 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"path"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types/mount"
|
|
|
|
)
|
|
|
|
|
|
|
|
var lcowSpecificValidators mountValidator = func(m *mount.Mount) error {
|
|
|
|
if path.Clean(m.Target) == "/" {
|
2018-01-14 06:10:49 -05:00
|
|
|
return ErrVolumeTargetIsRoot
|
2017-08-01 13:32:44 -04:00
|
|
|
}
|
|
|
|
if m.Type == mount.TypeNamedPipe {
|
|
|
|
return errors.New("Linux containers on Windows do not support named pipe mounts")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type lcowParser struct {
|
|
|
|
windowsParser
|
|
|
|
}
|
|
|
|
|
2017-12-19 05:44:29 -05:00
|
|
|
func (p *lcowParser) ValidateMountConfig(mnt *mount.Mount) error {
|
2017-08-01 13:32:44 -04:00
|
|
|
return p.validateMountConfigReg(mnt, rxLCOWDestination, lcowSpecificValidators)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *lcowParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) {
|
|
|
|
return p.parseMountRaw(raw, volumeDriver, rxLCOWDestination, false, lcowSpecificValidators)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *lcowParser) ParseMountSpec(cfg mount.Mount) (*MountPoint, error) {
|
|
|
|
return p.parseMountSpec(cfg, rxLCOWDestination, false, lcowSpecificValidators)
|
|
|
|
}
|