Skip to content

Database initialisation scripts and custom db path #148

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

Closed
deployable opened this issue Mar 22, 2017 · 4 comments
Closed

Database initialisation scripts and custom db path #148

deployable opened this issue Mar 22, 2017 · 4 comments

Comments

@deployable
Copy link

I use FROM mongo in Dockerfiles that occasionally setup custom mongo db paths.

It would be useful to have the initialisation scripts work in these circumstances, currently initialisation scripts run repeatedly as /data/db is never initialised.

Detecting --dbpath on the command line isn't too hard. Detecting dbPath in a config file is a bit harder.

Another option could be using a "state" file, possibly one for each of the "user" and "init" steps, stored in the container somewhere on successful init. Was that approach considered/avoided for the current implementation?

@deployable
Copy link
Author

I think most of these were to do database initialisation and avoid the /data/db VOLUME definition. Some could probably just move to using the new init setup.

@yosifkit
Copy link
Member

Sorry to break your Dockerfiles. 😞

We didn't detect dbpath since that would require finding and parsing all config files along with the command line arguments. (We can cheat with postgres since it uses the PGDATA variable automatically).

We considered a state file somewhere in the image, but it doesn't help when deleting the container and starting a new version with the same database files.

I would say 👍 to using the new init rather than storing the db in the image. The union file system in use (aufs, overlay, etc) for image layers can have negative impact on high I/O.

@deployable
Copy link
Author

No worries, only testing using the new features.

Thanks for the details. It probably just needs a documentation line to say init doesn't support paths other than /data/db.

@sdanieru
Copy link

sdanieru commented Apr 25, 2017

Hi tianon, thanks for the swift response! I'm not sure I completely understand the problem, but will changing the container's internal db path to the default (i.e. /data/db) solve the problem (the /data problem at least)?

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

3 participants