Calling mongodump wrapped into docker

My setup is as follows:

  • there is a mongodb replica set (v. 2.4.8), which I like to backup via mongodump
  • there is a machine (NAS) outside the replica set, which should perform the the backup task, but does not have the mongodump binary installed. But it has docker support.

So there is my idea to use docker to perform the mongodump on the NAS. A shell script “mongodump.sh” should wrap the docker call to mongodump with all needed params and I would call it like:

  • Ansible Docker Connection Error
  • Mysql socket is missing in my homestead docker container
  • AWS Multicontainer Docker using PHP and NGinx to install Laravel
  • Cannot stop a running docker container
  • Installing packages for Rstudio Docker
  • Logging from one docker container to another
  • mongodump.sh --host rs/url -u backup -p "password" --out ./dump/
    

    Is this possible with docker? What would the shell script look like?

  • Docker + Nodejs + Brunch + ReactJS image
  • Where to put folders for code in docker containers
  • How to link docker containers on build?
  • Docker container apt-get install can't find package
  • Error starting userland proxy: listen tcp0.0.0.0:3306: bind: address already in use
  • How to run “docker-compose up” command in .sh file?
  • One Solution collect form web for “Calling mongodump wrapped into docker”

    If found the solution. The command I use to perform the mongodump via docker ist:

    docker run --rm --name some-mongo -v /volume1/Backups/mongodump:/dumps --entrypoint mongodump mongo --host rs1/myserver.net -u backup -p "password" --out /dumps
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.