{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/17585","labels_url":"https://api.github.com/repos/docker/docker/issues/17585/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/17585/comments","events_url":"https://api.github.com/repos/docker/docker/issues/17585/events","html_url":"https://github.com/docker/docker/issues/17585","id":114449036,"number":17585,"title":"Volume plugin Unmount Issues","user":{"login":"rsmoorthy","id":1160172,"avatar_url":"https://avatars.githubusercontent.com/u/1160172?v=3","gravatar_id":"","url":"https://api.github.com/users/rsmoorthy","html_url":"https://github.com/rsmoorthy","followers_url":"https://api.github.com/users/rsmoorthy/followers","following_url":"https://api.github.com/users/rsmoorthy/following{/other_user}","gists_url":"https://api.github.com/users/rsmoorthy/gists{/gist_id}","starred_url":"https://api.github.com/users/rsmoorthy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsmoorthy/subscriptions","organizations_url":"https://api.github.com/users/rsmoorthy/orgs","repos_url":"https://api.github.com/users/rsmoorthy/repos","events_url":"https://api.github.com/users/rsmoorthy/events{/privacy}","received_events_url":"https://api.github.com/users/rsmoorthy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-01T03:58:02Z","updated_at":"2015-11-01T03:58:02Z","closed_at":null,"body":"Using Docker Volume Plugin\r\nDocker version: 1.8.2\r\n\r\n* Start a container, using a volume plugin:\r\n```\r\ndocker run -id --name first -v volname:/data --volume-driver=plugin ubuntu bash\r\n```\r\n* The volume plugin receives these calls, and the volume gets mounted:\r\n```\r\nCreate: {\"Name\":\"volname\"}\r\nPath: {\"Name\":\"volname\"}       Responds with {MountPoint: /mnt/volname, Err:null}\r\nPath: {\"Name\":\"volname\"}      Responds with {MountPoint: /mnt/volname, Err:null}\r\nMount: {\"Name\":\"volname\"}      Responds with {MountPoint: /mnt/volname, Err:null}\r\n```\r\n* Start another container, with the same volume name:\r\n```\r\ndocker run -id --name second -v volname:/data --volume-driver=plugin ubuntu bash\r\n```\r\n* The volume plugin gets the same set of calls and responds exactly the same way.\r\n* Now stop the second container. The volume plugin receives an unmount request.\r\n```\r\nUnmount: {\"Name\":\"volname\"}      Responds with {MountPoint: /mnt/volname, Err:null}\r\n```\r\n\r\n**The volume plugin unmounts volume, while the first container still expects the volume to be available**\r\n\r\nPossible solutions:\r\n* Volume Plugin could possibly keep track of \"Create\" requests as the count of containers and do the actual unmount at the last Unmount call.\r\n    - However, Docker does not call \"Remove\" API call, on deletion of containers (unless there is an error)\r\n* For the given volume name, Docker daemon should only call Unmount API call on the last container  being stopped.\r\n* Docker could provide a reference value (referring the container), along with each Create/Mount/Unmount call -- so that the Volume plugin can unmount at the last possible scenario.\r\n\r\nPlease refer to https://github.com/rsmoorthy/docker-volume-plugin-helloworld that uses SSHFS as the backend, using which it was tested. This [reference](https://github.com/rsmoorthy/docker-volume-plugin-helloworld/blob/master/Unmount_Issues.md) explains how the lazy unmounting, helped the first container retain the mount, even after the second container had stopped.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/152792157","html_url":"https://github.com/docker/docker/issues/17585#issuecomment-152792157","issue_url":"https://api.github.com/repos/docker/docker/issues/17585","id":152792157,"user":{"login":"GordonTheTurtle","id":10620046,"avatar_url":"https://avatars.githubusercontent.com/u/10620046?v=3","gravatar_id":"","url":"https://api.github.com/users/GordonTheTurtle","html_url":"https://github.com/GordonTheTurtle","followers_url":"https://api.github.com/users/GordonTheTurtle/followers","following_url":"https://api.github.com/users/GordonTheTurtle/following{/other_user}","gists_url":"https://api.github.com/users/GordonTheTurtle/gists{/gist_id}","starred_url":"https://api.github.com/users/GordonTheTurtle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GordonTheTurtle/subscriptions","organizations_url":"https://api.github.com/users/GordonTheTurtle/orgs","repos_url":"https://api.github.com/users/GordonTheTurtle/repos","events_url":"https://api.github.com/users/GordonTheTurtle/events{/privacy}","received_events_url":"https://api.github.com/users/GordonTheTurtle/received_events","type":"User","site_admin":false},"created_at":"2015-11-01T03:58:02Z","updated_at":"2015-11-01T03:58:02Z","body":"Hi!\n\t\nPlease read this important information about creating issues.\n\nIf you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.\n\nIf you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.\n\nThis is an automated, informational response. \n\nThank you.\n\nFor more information about reporting issues, see https://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting-other-issues \n\n-----------------------------\nBUG REPORT INFORMATION\n-----------------------------\nUse the commands below to provide key information from your environment:\n\n`docker version`:\n`docker info`:\n`uname -a`:\n\nProvide additional environment details (AWS, VirtualBox, physical, etc.):\n\n\n\nList the steps to reproduce the issue:\n1.\n2.\n3.\n\n\nDescribe the results you received:\n\n\nDescribe the results you expected:\n\n\nProvide additional info you think is important:\n\n\n----------END REPORT ---------\n\n\n\n#ENEEDMOREINFO\n"}}