{"action":"opened","issue":{"url":"https://api.github.com/repos/docker/docker/issues/17040","labels_url":"https://api.github.com/repos/docker/docker/issues/17040/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/17040/comments","events_url":"https://api.github.com/repos/docker/docker/issues/17040/events","html_url":"https://github.com/docker/docker/issues/17040","id":111485907,"number":17040,"title":"volume removal behavior unexpected when using `--rm` in run command","user":{"login":"mbentley","id":414445,"avatar_url":"https://avatars.githubusercontent.com/u/414445?v=3","gravatar_id":"","url":"https://api.github.com/users/mbentley","html_url":"https://github.com/mbentley","followers_url":"https://api.github.com/users/mbentley/followers","following_url":"https://api.github.com/users/mbentley/following{/other_user}","gists_url":"https://api.github.com/users/mbentley/gists{/gist_id}","starred_url":"https://api.github.com/users/mbentley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbentley/subscriptions","organizations_url":"https://api.github.com/users/mbentley/orgs","repos_url":"https://api.github.com/users/mbentley/repos","events_url":"https://api.github.com/users/mbentley/events{/privacy}","received_events_url":"https://api.github.com/users/mbentley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-14T20:30:45Z","updated_at":"2015-10-14T20:30:45Z","closed_at":null,"body":"Description of problem:\r\nWith the new `docker volumes` features in 1.9.0-rc1, some behavior is a bit unexpected when working with pre-existing volumes.  For example, if I manually create a volume for use, run a quick container that is attached to it using `docker run -it --rm -v myvolume:/data debian:jessie`, do some quick tasks with my data and then exit the container, my volume gets removed along with the container if no other containers are using it.\r\n\r\nThis makes sense from a legacy standpoint because of how `--rm` works but it doesn't really make sense now that we can manage volumes.  If the volume existed before I started my container, I do not think that `--rm` should remove the volume, it should persist until I tell it that it should be removed.  Whether this is some sort of flag that I can set on the daemon or whatever, it seems like trusting my data in volumes that are managed by docker can be troublesome from a data persistence standpoint.\r\n\r\n`docker version`:\r\n$ docker version\r\n\r\n```\r\nClient:\r\n Version:      1.9.0-rc1\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   9291a0e\r\n Built:        Wed Oct 14 02:48:58 UTC 2015\r\n OS/Arch:      linux/amd64\r\n\r\nServer:\r\n Version:      1.9.0-rc1\r\n API version:  1.21\r\n Go version:   go1.4.2\r\n Git commit:   9291a0e\r\n Built:        Wed Oct 14 02:48:58 UTC 2015\r\n OS/Arch:      linux/amd64\r\n```\r\n\r\n`docker info`:\r\n\r\n```\r\nContainers: 0\r\nImages: 2\r\nEngine Version: 1.9.0-rc1\r\nStorage Driver: aufs\r\n Root Dir: /var/lib/docker/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 2\r\n Dirperm1 Supported: true\r\nExecution Driver: native-0.2\r\nLogging Driver: json-file\r\nKernel Version: 3.16.0-4-amd64\r\nOperating System: Debian GNU/Linux stretch/sid (containerized)\r\nCPUs: 2\r\nTotal Memory: 1.963 GiB\r\nName: localdev\r\nID: ABO2:4REM:BS7R:OXYG:R7V6:UJGL:2YTX:CJ7H:UEYY:IK7O:JXYQ:YBYX\r\nUsername: mbentley\r\nRegistry: https://index.docker.io/v1/\r\n```\r\n\r\n`uname -a`:\r\n\r\n```\r\nLinux localdev 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux\r\n```\r\n\r\nEnvironment details (AWS, VirtualBox, physical, etc.):\r\nVirtualBox 5.0.6r103037, Debian Sid\r\n\r\nHow reproducible:\r\nAll the time\r\n\r\nSteps to Reproduce:\r\n1. Create a volume: `docker volume create --name test`\r\n2. Run a container that uses the volume: `docker run -it --rm -v test:/data debian:jessie`\r\n3. Exit the container and see that the volume is no longer there: `docker volume ls`\r\n\r\n\r\nActual Results:\r\nVolume that I created and manage manually was automatically removed.\r\n\r\nExpected Results:\r\nVolume that I created and manage manually shouldn't be automatically removed.\r\n\r\nAdditional info:"}}