just check -v /src:dest and test it

Signed-off-by: xlgao <xlgao@zju.edu.cn>
Upstream-commit: 50be74ba1479278cc220633365cdd1c5a21d7cda
Component: engine
This commit is contained in:
xlgao
2015-08-31 10:48:34 +08:00
committed by Your Name
parent 26c8e31eba
commit d30ce2eec5
3 changed files with 7 additions and 1 deletions

View File

@ -52,6 +52,7 @@ func TestParseBindMount(t *testing.T) {
{"name:/tmp", "external", "/tmp", "", "name", "external", "", true, false},
{"name:/tmp:ro", "local", "/tmp", "", "name", "local", "", false, false},
{"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", "", true, false},
{"/tmp:tmp", "", "", "", "", "", "", true, true},
}
for _, c := range cases {

View File

@ -2,7 +2,7 @@ package daemon
import "testing"
func TestParseVolumeFrom(t *testing.T) {
func TestParseVolumesFrom(t *testing.T) {
cases := []struct {
spec string
expId string

View File

@ -81,6 +81,11 @@ func parseBindMount(spec string, mountLabel string, config *runconfig.Config) (*
return nil, fmt.Errorf("Invalid volume specification: %s", spec)
}
//validate the volumes destination path
if !filepath.IsAbs(bind.Destination) {
return nil, fmt.Errorf("Invalid volume destination path: %s mount path must be absolute.", bind.Destination)
}
name, source, err := parseVolumeSource(arr[0])
if err != nil {
return nil, err