github.com/ttys3/engine@v17.12.1-ce-rc2+incompatible/volume/lcow_parser.go (about)

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