Skip to content

Database initialisation scripts and custom db path #148

Closed

Description

@deployable

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?

Activity

  1. deployable commented on Mar 22, 2017

    @deployable
    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.

  2. yosifkit commented on Mar 22, 2017

    @yosifkit
    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.

  3. deployable commented on Mar 22, 2017

    @deployable
    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.

  4. sdanieru commented on Apr 25, 2017

    @sdanieru

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions