|
|
|
|
|
by shykes
4691 days ago
|
|
Hey StavrosK, This is by design, "I want the postgres db data to live outside the container" is a deployment-specific decision, and should not be hardcoded into the container itself. You (or someone you distribute this container to) might not want the db data to live outside the container, or might want it to live at a specific path on his machine. That's why a Dockerfile lets you specify that /var/lib/postgres is persistent, but doesn't let you specify how to persist it. Now, if I remember our IRC discussion correctly, in your case you're hitting a limitation of docker's implementation of volumes, which is that the container cannot specify an initial state for its volume - it can only start empty. That is a limitation that we're going to fix. But we need to make sure we fix it without breaking portability of containers. I hope this helps. |
|
Your proposal of having the container specify an initial state would certainly work. Exactly how to do this will take some thinking (what if the external volume has some files in it? What if it's empty but the user needs it empty? Etc), but I think this is a necessary feature for a large variety of use cases.
Thanks for the reply!