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:

  • bind docker containers services start on the specific port
  • Running OpenSSH in an Alpine Docker Container
  • Host as Pid namespace in Docker
  • How to get the mapped port on host from a docker container?
  • PHPUnit Selenium tests fail on Docker localhost and pass using public IP
  • How to sandbox Ansible playbooks for high availability Glassfish application on AWS
  • mongodump.sh --host rs/url -u backup -p "password" --out ./dump/
    

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

  • “CMD ['/home/user/script.sh']” in docker file doesn't work with docker-compose
  • What does it mean to attach a tty/std-in-out to dockers or lxc?
  • How to bind a shared directory from container to host in Docker
  • apt-get install -f does not resolve dependencies
  • PHP echo statement with URL parameter
  • Accessing Docker-compose containers hostnames from a container
  • 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.