{"action":"opened","issue":{"url":"https://api.github.com/repos/realpython/dockerizing-django/issues/21","repository_url":"https://api.github.com/repos/realpython/dockerizing-django","labels_url":"https://api.github.com/repos/realpython/dockerizing-django/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/realpython/dockerizing-django/issues/21/comments","events_url":"https://api.github.com/repos/realpython/dockerizing-django/issues/21/events","html_url":"https://github.com/realpython/dockerizing-django/issues/21","id":148101453,"number":21,"title":"data container pattern obsolete","user":{"login":"oppianmatt","id":48596,"avatar_url":"https://avatars.githubusercontent.com/u/48596?v=3","gravatar_id":"","url":"https://api.github.com/users/oppianmatt","html_url":"https://github.com/oppianmatt","followers_url":"https://api.github.com/users/oppianmatt/followers","following_url":"https://api.github.com/users/oppianmatt/following{/other_user}","gists_url":"https://api.github.com/users/oppianmatt/gists{/gist_id}","starred_url":"https://api.github.com/users/oppianmatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oppianmatt/subscriptions","organizations_url":"https://api.github.com/users/oppianmatt/orgs","repos_url":"https://api.github.com/users/oppianmatt/repos","events_url":"https://api.github.com/users/oppianmatt/events{/privacy}","received_events_url":"https://api.github.com/users/oppianmatt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-13T15:37:14Z","updated_at":"2016-04-13T15:37:14Z","closed_at":null,"body":"docker now no longer cleans up volumes that aren't referenced so the docker data container pattern is obsolete.\r\n\r\nhttps://docs.docker.com/engine/userguide/containers/dockervolumes/\r\n\r\n> Data volumes persist even if the container itself is deleted.\r\n\r\nSo you can remove the `data` entry in compose and replace the postgres entry with:\r\n\r\n```\r\npostgres:\r\n  restart: always\r\n  image: postgres:latest\r\n  ports:\r\n    - \"5432:5432\"\r\n  volumes:\r\n    - pgdata:/var/lib/postgresql/data/\r\n```\r\n\r\nThis uses a named volume (so you can find it easily).\r\n\r\nShould probably give redis a volume to so it's persisted:\r\n\r\n```\r\nredis:\r\n  restart: always\r\n  image: redis:latest\r\n  ports:\r\n    - \"6379:6379\"\r\n  volumes:\r\n    - redisdata:/data\r\n```"}}