Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data container pattern obsolete #21

Closed
oppianmatt opened this issue Apr 13, 2016 · 1 comment
Closed

data container pattern obsolete #21

oppianmatt opened this issue Apr 13, 2016 · 1 comment

Comments

@oppianmatt
Copy link

docker now no longer cleans up volumes that aren't referenced so the docker data container pattern is obsolete.

https://docs.docker.com/engine/userguide/containers/dockervolumes/

Data volumes persist even if the container itself is deleted.

So you can remove the data entry in compose and replace the postgres entry with:

postgres:
  restart: always
  image: postgres:latest
  ports:
    - "5432:5432"
  volumes:
    - pgdata:/var/lib/postgresql/data/

This uses a named volume (so you can find it easily).

Should probably give redis a volume to so it's persisted:

redis:
  restart: always
  image: redis:latest
  ports:
    - "6379:6379"
  volumes:
    - redisdata:/data
@mjhea0
Copy link
Contributor

mjhea0 commented Apr 17, 2016

Thanks! Updating the code and the blog post now!

@mjhea0 mjhea0 closed this as completed Apr 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants