{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/16132","labels_url":"https://api.github.com/repos/docker/docker/issues/16132/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/16132/comments","events_url":"https://api.github.com/repos/docker/docker/issues/16132/events","html_url":"https://github.com/docker/docker/issues/16132","id":105317689,"number":16132,"title":"Volumes: relative host-path creates named volumes","user":{"login":"thaJeztah","id":1804568,"avatar_url":"https://avatars.githubusercontent.com/u/1804568?v=3","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/kind/bug","name":"kind/bug","color":"FF8C94"},{"url":"https://api.github.com/repos/docker/docker/labels/status/claimed","name":"status/claimed","color":"ededed"},{"url":"https://api.github.com/repos/docker/docker/labels/system/storage","name":"system/storage","color":"FBCA04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-08T07:25:51Z","updated_at":"2015-09-08T12:13:30Z","closed_at":null,"body":"While reviewing a PR (https://github.com/docker/docker/pull/16100#issuecomment-138455740), I discovered that using a *relative* path as host path, will create a named volume, instead of erroring out or creating a bind-mounted volume.\r\n\r\nTo reproduce;\r\n\r\n```bash\r\ndocker run -v ./:/foobar ubuntu\r\n```\r\n\r\nThen inspect the container;\r\n\r\n    \"Mounts\": [\r\n        {\r\n            \"Name\": \"./\",\r\n            \"Source\": \"/var/lib/docker/volumes/_data\",\r\n            \"Destination\": \"/foobar\",\r\n            \"Driver\": \"local\",\r\n            \"Mode\": \"z\",\r\n            \"RW\": true\r\n        }\r\n    ],\r\n\r\n\r\nFrom the inspect, it's visible that a volume named `\"./\"` is created\r\n\r\nNote that using `-v ~/:/foobar` *does work*;\r\n\r\n    \"Mounts\": [\r\n        {\r\n            \"Source\": \"/root\",\r\n            \"Destination\": \"/foobar\",\r\n            \"Mode\": \"\",\r\n            \"RW\": true\r\n        }\r\n    ],\r\n\r\n\r\n**Expected result**\r\n\r\nDocker producing an error\r\n\r\nI think we should (at least, for now) only allow `[a-zA-Z0-9][a-zA-Z0-9_.-]+` for volume-names, anything else should produce an error.\r\n\r\n**Actual result**\r\n\r\nDocker created a volume named `\"./\"`\r\n\r\ndocker version\r\n```\r\nClient:\r\n Version:      1.9.0-dev\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   8562c42\r\n Built:        Sat Sep  5 12:34:19 UTC 2015\r\n OS/Arch:      linux/amd64\r\n\r\nServer:\r\n Version:      1.9.0-dev\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   8562c42\r\n Built:        Sat Sep  5 12:34:19 UTC 2015\r\n OS/Arch:      linux/amd64\r\n```\r\n\r\ndocker info\r\n```\r\nContainers: 16\r\nImages: 579\r\nStorage Driver: aufs\r\n Root Dir: /var/lib/docker/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 620\r\n Dirperm1 Supported: false\r\nExecution Driver: native-0.2\r\nLogging Driver: json-file\r\nKernel Version: 3.13.0-61-generic\r\nOperating System: Ubuntu 14.04.3 LTS\r\nCPUs: 1\r\nTotal Memory: 994 MiB\r\nName: [REDACTED]\r\nID: [REDACTED]\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/138535714","html_url":"https://github.com/docker/docker/issues/16132#issuecomment-138535714","issue_url":"https://api.github.com/repos/docker/docker/issues/16132","id":138535714,"user":{"login":"xlgao-zju","id":1636894,"avatar_url":"https://avatars.githubusercontent.com/u/1636894?v=3","gravatar_id":"","url":"https://api.github.com/users/xlgao-zju","html_url":"https://github.com/xlgao-zju","followers_url":"https://api.github.com/users/xlgao-zju/followers","following_url":"https://api.github.com/users/xlgao-zju/following{/other_user}","gists_url":"https://api.github.com/users/xlgao-zju/gists{/gist_id}","starred_url":"https://api.github.com/users/xlgao-zju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xlgao-zju/subscriptions","organizations_url":"https://api.github.com/users/xlgao-zju/orgs","repos_url":"https://api.github.com/users/xlgao-zju/repos","events_url":"https://api.github.com/users/xlgao-zju/events{/privacy}","received_events_url":"https://api.github.com/users/xlgao-zju/received_events","type":"User","site_admin":false},"created_at":"2015-09-08T12:13:30Z","updated_at":"2015-09-08T12:13:30Z","body":"That's ok. I'll fix\r\n\r\n    Agree if [a-zA-Z0-9][a-zA-Z0-9_.-]+ is what we want \r\n\r\nat first."}}