github.com/a4a881d4/docker@v1.9.0-rc2/volume/local/local_unix.go (about) 1 // +build linux freebsd 2 3 // Package local provides the default implementation for volumes. It 4 // is used to mount data volume containers and directories local to 5 // the host server. 6 package local 7 8 import ( 9 "path/filepath" 10 "strings" 11 ) 12 13 var oldVfsDir = filepath.Join("vfs", "dir") 14 15 // scopedPath verifies that the path where the volume is located 16 // is under Docker's root and the valid local paths. 17 func (r *Root) scopedPath(realPath string) bool { 18 // Volumes path for Docker version >= 1.7 19 if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) { 20 return true 21 } 22 23 // Volumes path for Docker version < 1.7 24 if strings.HasPrefix(realPath, filepath.Join(r.scope, oldVfsDir)) { 25 return true 26 } 27 28 return false 29 }