{"action":"created","issue":{"url":"https://api.github.com/repos/moby/moby/issues/33782","repository_url":"https://api.github.com/repos/moby/moby","labels_url":"https://api.github.com/repos/moby/moby/issues/33782/labels{/name}","comments_url":"https://api.github.com/repos/moby/moby/issues/33782/comments","events_url":"https://api.github.com/repos/moby/moby/issues/33782/events","html_url":"https://github.com/moby/moby/issues/33782","id":237920354,"number":33782,"title":"Proposal: Add snapshots & clones to the Docker Volume engine","user":{"login":"clintonk","id":1355869,"avatar_url":"https://avatars3.githubusercontent.com/u/1355869?v=3","gravatar_id":"","url":"https://api.github.com/users/clintonk","html_url":"https://github.com/clintonk","followers_url":"https://api.github.com/users/clintonk/followers","following_url":"https://api.github.com/users/clintonk/following{/other_user}","gists_url":"https://api.github.com/users/clintonk/gists{/gist_id}","starred_url":"https://api.github.com/users/clintonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintonk/subscriptions","organizations_url":"https://api.github.com/users/clintonk/orgs","repos_url":"https://api.github.com/users/clintonk/repos","events_url":"https://api.github.com/users/clintonk/events{/privacy}","received_events_url":"https://api.github.com/users/clintonk/received_events","type":"User","site_admin":false},"labels":[{"id":439928930,"url":"https://api.github.com/repos/moby/moby/labels/area/volumes","name":"area/volumes","color":"fbca04","default":false},{"id":179237833,"url":"https://api.github.com/repos/moby/moby/labels/kind/feature","name":"kind/feature","color":"AAB3AB","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":36,"created_at":"2017-06-22T17:38:08Z","updated_at":"2017-06-26T16:56:59Z","closed_at":null,"body":"## Summary\r\n\r\nThere are numerous high-value Docker use cases that could be satisfied if the Docker Volume engine supported volume snapshots and clones.  Examples include:\r\n\r\n* Rapidly create identical copies of Docker volumes\r\n  * Test & training environments\r\n  * Experimentation on temporary copies of data sets\r\n\r\n* Create periodic snapshots of Docker volumes\r\n  * Best practice of keeping regular snapshots of critical data\r\n  * Backup tools that copy snapshots to a separate location\r\n\r\n* Create a Docker volume initialized to the contents of an earlier snapshot\r\n  * Recovery of deleted files or earlier file versions\r\n\r\n* Rollback a Docker volume to an earlier snapshot\r\n  * Rapid recovery from accidental or malicious deletion or corruption\r\n\r\n## Plan\r\n\r\nWe propose to modify Docker (and have already done the work!) to add support for volume snapshots and clones.  The following Docker CLI commands are needed and are designed to “feel” identical to the existing volume commands:\r\n\r\n* docker volume clone\r\n  * Creates a new volume by cloning an existing volume, either directly or from a specified snapshot\r\n  * `volume clone [OPTIONS] VOLUME SOURCE_VOLUME [SOURCE_SNAPSHOT]`\r\n\r\n* docker volume snapshot create\r\n  * Creates a new snapshot of a volume\r\n  * `volume snapshot create [OPTIONS] VOLUME SNAPSHOT`\r\n\r\n* docker volume snapshot inspect\r\n  * Returns details of one or more snapshots, including volume name, snapshot name, and snapshot creation time\r\n  * `volume snapshot inspect [OPTIONS] VOLUME SNAPSHOT [SNAPSHOT...]`\r\n\r\n* docker volume snapshot ls\r\n  * Lists all the snapshots of a specific volume in tabular form, including snapshot name and creation time\r\n  * `volume snapshot ls [OPTIONS] VOLUME`\r\n\r\n* docker volume snapshot rename\r\n  * Renames an existing snapshot\r\n  * `volume snapshot rename [OPTIONS] VOLUME SNAPSHOT NEW_NAME`\r\n\r\n* docker volume snapshot restore\r\n  * Reverts the contents of a volume (in place) to an earlier snapshot\r\n  * `volume snapshot restore [OPTIONS] VOLUME SNAPSHOT`\r\n\r\n* docker volume snapshot rm\r\n  * Deletes one or more volume snapshots\r\n  * `volume snapshot rm [OPTIONS] VOLUME SNAPSHOT [SNAPSHOT...]`\r\n\r\nAdding this feature requires modification of several components: the Docker client/CLI, the engine, and the volume plugin library.\r\n\r\nNot only have we developed this feature, but we even demonstrated it on stage during a DockerCon 2017 session.  Please see a video demo here: ([link](http://netapp.io/2017/06/22/snapshots-clones-docker-volume-paradigm/)).\r\n\r\n## Notes\r\n\r\nWe're posting this proposal to gauge interest, and we are glad to follow up with code, unit tests, etc.\r\n\r\nIt's worth noting that the Kubernetes community is actively building support for volume snapshots, and volume clones are also a roadmap item, so supporting such basic storage features will soon become table stakes for container orchestrators.\r\n\r\nNote also that multiple filesystems used by Docker today, such as btrfs and zfs, support snapshots and could be enhanced to support this feature.\r\n\r\nWe can leverage extensive experience developing similar functionality in OpenStack ([link](https://www.youtube.com/watch?v=yQpg99L7Vno)).  For example, when restoring a volume to a snapshot, some storage systems automatically delete all snapshots newer than the one being restored.  That may be considered a form of data loss, so the safest approach is to only allow restoring a volume to the newest snapshot available.\r\n"},"comment":{"url":"https://api.github.com/repos/moby/moby/issues/comments/311118845","html_url":"https://github.com/moby/moby/issues/33782#issuecomment-311118845","issue_url":"https://api.github.com/repos/moby/moby/issues/33782","id":311118845,"user":{"login":"clintonk","id":1355869,"avatar_url":"https://avatars3.githubusercontent.com/u/1355869?v=3","gravatar_id":"","url":"https://api.github.com/users/clintonk","html_url":"https://github.com/clintonk","followers_url":"https://api.github.com/users/clintonk/followers","following_url":"https://api.github.com/users/clintonk/following{/other_user}","gists_url":"https://api.github.com/users/clintonk/gists{/gist_id}","starred_url":"https://api.github.com/users/clintonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintonk/subscriptions","organizations_url":"https://api.github.com/users/clintonk/orgs","repos_url":"https://api.github.com/users/clintonk/repos","events_url":"https://api.github.com/users/clintonk/events{/privacy}","received_events_url":"https://api.github.com/users/clintonk/received_events","type":"User","site_admin":false},"created_at":"2017-06-26T16:56:59Z","updated_at":"2017-06-26T16:56:59Z","body":"@justincormack @scaleoutsean We have to assume there will be volume plugins that don't support snapshots or other advanced features; otherwise further innovation in this space wouldn't be possible.  The volume plugins include a Capabilities() entry point, which is not used for much at present.  Although not yet included in our working implementation, I had envisioned using the Capabilities API to allow volume drivers to indicate support for snapshot-related actions.  As @innergy implied, the Docker engine would look at the capability bits and return an appropriate error as needed."}}
{"actor":{"display_login":"clintonk"}}