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)

  • Error when running application at the container -Docker
  • Cannot ssh to server as I install on OVH dedicated server
  • Docker swarm: How to specify cpu units provided by a node?
  • Mount data volume to docker with read&write permission
  • CI: Should I run tests directly or through Docker container?
  • How to write docker file to run a docker run command inside an image
  • 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!

  • Unable to access local network IP from docker container
  • How to give docker exclusive access to cpus?
  • How do I tag a local docker image with ansible docker_image module?
  • Failed to execute fabric8 docker plugin
  • No containers on Docker Shipyard GUI startup
  • How do I undo the command $ eval “$(docker-machine env blog)”
  • 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.