{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/16068","labels_url":"https://api.github.com/repos/docker/docker/issues/16068/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/16068/comments","events_url":"https://api.github.com/repos/docker/docker/issues/16068/events","html_url":"https://github.com/docker/docker/issues/16068","id":104792837,"number":16068,"title":"Docker volume create should not be idempotent (by default)","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/enhancement","name":"kind/enhancement","color":"E8CAAF"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/docker/docker/milestones/41","html_url":"https://github.com/docker/docker/milestones/1.9.0","labels_url":"https://api.github.com/repos/docker/docker/milestones/41/labels","id":1211905,"number":41,"title":"1.9.0","description":"","creator":{"login":"dmp42","id":332946,"avatar_url":"https://avatars.githubusercontent.com/u/332946?v=3","gravatar_id":"","url":"https://api.github.com/users/dmp42","html_url":"https://github.com/dmp42","followers_url":"https://api.github.com/users/dmp42/followers","following_url":"https://api.github.com/users/dmp42/following{/other_user}","gists_url":"https://api.github.com/users/dmp42/gists{/gist_id}","starred_url":"https://api.github.com/users/dmp42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmp42/subscriptions","organizations_url":"https://api.github.com/users/dmp42/orgs","repos_url":"https://api.github.com/users/dmp42/repos","events_url":"https://api.github.com/users/dmp42/events{/privacy}","received_events_url":"https://api.github.com/users/dmp42/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":12,"state":"open","created_at":"2015-07-16T20:50:09Z","updated_at":"2015-09-03T22:21:43Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-09-03T22:21:43Z","updated_at":"2015-09-03T22:23:18Z","closed_at":null,"body":"This issue is to discuss the behavior of `docker volume create` for *named* volumes. **I'd like to have consensus on this _before_ the 1.9 release** to prevent awkward, backward-compatibility breaking changes after that.\r\n\r\nCurrently, `docker volume create --name foo` will *create* a volume if it doesn't exist, and will be a \"no-op\" if a volume with that name already exists.\r\n\r\nI think this behavior should be changed for a couple of reasons;\r\n\r\n- It's inconsistent with other parts of Docker (e.g. `docker run --name foo` will fail if container `foo` already exists)\r\n- It can lead to unexpected behavior; the user does not know if a new volume was created, or an existing (possibly non-related) volume was re-used.\r\n- Given that the Volume API does *not* keep track of the *driver options* that were used to *create* a volume, there is *no* guarantee that the volume is using the options that the user passed (example below)\r\n\r\n**Example 1 - using the wrong volume**\r\n\r\nThe user creates volume `myvol`, and uses the volume for a container\r\n\r\n```bash\r\ndocker volume create --name dbdata\r\ndocker run -d -v dbdata:/var/lib/mysql/ mysql\r\n```\r\n\r\nAt a later stage, the user does the same (e.g. for a different project),\r\nleading to the existing volume being used unknowingly; **this can lead to data-loss** if data in the existing volume is overwritten\r\n\r\n```bash\r\ndocker volume create --name dbdata\r\ndocker run -d -v dbdata:/var/lib/postgresql/data/ postgres\r\n```\r\n\r\n\r\n**Example 2 - using the wrong options**\r\n\r\nThe user creates volume `myvol` with some options\r\n\r\n```bash\r\ndocker volume create --name myvol --driver foo --opt something=A --opt bar=baz\r\n```\r\n\r\nAt a later stage, creating a volume (using *different* options), will be silently ignored:\r\n\r\n```bash\r\ndocker volume create --name myvol --driver foo --opt something=B --opt baz=example\r\n```\r\n\r\nNote that it's currently *not* possible to detect that the options are not applied, because [`docker volume inspect`](https://github.com/docker/docker/blob/master/docs/reference/commandline/volume_inspect.md) does *not* return the options that were used to create the volume."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/137590005","html_url":"https://github.com/docker/docker/issues/16068#issuecomment-137590005","issue_url":"https://api.github.com/repos/docker/docker/issues/16068","id":137590005,"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},"created_at":"2015-09-03T22:23:18Z","updated_at":"2015-09-03T22:23:18Z","body":"/cc @cpuguy83 @calavera @icecrime just so we are sure we have everything \"right\" before it's in a release"}}