{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/10947","labels_url":"https://api.github.com/repos/docker/docker/issues/10947/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/10947/comments","events_url":"https://api.github.com/repos/docker/docker/issues/10947/events","html_url":"https://github.com/docker/docker/issues/10947","id":58612856,"number":10947,"title":"Please explain how to overlay volumes over an image","user":{"login":"devurandom","id":63082,"avatar_url":"https://avatars.githubusercontent.com/u/63082?v=3","gravatar_id":"","url":"https://api.github.com/users/devurandom","html_url":"https://github.com/devurandom","followers_url":"https://api.github.com/users/devurandom/followers","following_url":"https://api.github.com/users/devurandom/following{/other_user}","gists_url":"https://api.github.com/users/devurandom/gists{/gist_id}","starred_url":"https://api.github.com/users/devurandom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devurandom/subscriptions","organizations_url":"https://api.github.com/users/devurandom/orgs","repos_url":"https://api.github.com/users/devurandom/repos","events_url":"https://api.github.com/users/devurandom/events{/privacy}","received_events_url":"https://api.github.com/users/devurandom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels/status/more-info-needed","name":"status/more-info-needed","color":"C6A49A"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-23T16:46:32Z","updated_at":"2015-07-22T13:10:55Z","closed_at":"2015-07-22T03:42:07Z","body":"From [Managing Data in Containers](http://docs.docker.com/userguide/dockervolumes/) in the docs I gather that volumes will completely replace the contents of the directory in the container, just as mount does.\r\n\r\nIs there a way to overlay them instead? My use case is having `/var` as a persistent volume to catch all write accesses. As applications usually require a certain directory layout, which they setup on install-time, I somehow need that as the basis for my volume and only record changes to files in the volume. This also needs to work for containers created from different dockerfiles. Thus I assume overlaying the volumes over the container image would be ideal."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/123714884","html_url":"https://github.com/docker/docker/issues/10947#issuecomment-123714884","issue_url":"https://api.github.com/repos/docker/docker/issues/10947","id":123714884,"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-07-22T13:10:55Z","updated_at":"2015-07-22T13:10:55Z","body":"@devurandom yup, volumes are only removed if there are no more containers using it **and only** if the `-v` flag is used when calling `docker rm`. So `docker rm -v mycontainer` will remove the volume as well (unless it's referenced by another container)"}}