persist and share data from docker mongo container (with docker)

Need a push in the right direction with this one.

I want to “dev0ps” the workflow of our local development with docker.
As best practice our mongodb should run in a seperate container, having a volume attached and working. (this part checks out fine)

  • File permission error when installing Meteor in Docker
  • Is there anyway to start rsyslogd without sudo access?
  • Dockerizing Spring Boot App with Postgresql
  • Error with Loadbalancing, Websockets and NodeJS
  • How to create windows docker image with VS test agents?
  • Mounting (possibly corrupt) docker partitions with devicemapper
  • Our developers should then keep the data in sync, so its able to be “pushed & pulled”.

    Can i achieve this with git? (The data folder is around 500mb, but this is just a fresh project)

    Should i write a script that performs a mongodump and upload it (to git?)?

    Should i consider spinning up a mongodb server of my own, where they push and pull from?

    thanks in advance!

  • Best practice re running bash for attaching to Docker running instance
  • Datanode denied communication with namenode because hostname cannot be resolved
  • Published k8s service is not available
  • How to use port forwarding to connect to docker container using DNS name
  • How to use docker to create a minimal live ISO that runs docker?
  • Docker: Connect to container (without exposing ports)
  • One Solution collect form web for “persist and share data from docker mongo container (with docker)”

    I see what you’re trying to achieve, but I don’t think the best approach is to keep neither the data from one local working copy in sync inside Git, as this is likely to provide inconsistencies in the Database if Developers have different copies of the data.

    The best thing you could do is have a set of Fixtures (Application Data inside the MongoDB database) which is inserted and deleted via your code, that way you control what goes inside the database and what does not, That data can very well be included in the Git repository in a folder called fixtures or database.

    You could also have different sets of data, one for developing, one for testing, etc. As you can see you can make it as complex or complementary as possible.

    I’ve been using this approach for more than one year and has not presented any problems.

    Let me know if you have any concerns about this approach.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.