title: docker backup and restore mongodb
body: <p>Create data only container:</p>
  
  <pre><code>docker create -v /mongodb_data --name mongodb_data mongo
  </code></pre>
  
  <p>Create monogdb container:</p>
  
  <pre><code>docker run --volumes-from mongodb_data --name mongo_db --restart always -d mongo
  </code></pre>
  
  <p>Then to use mongodb in my own container I use the link command:</p>
  
  <pre><code>--link mongo_db:mongo
  </code></pre>
  
  <p>So everything works fine. Now I want to backup the mongodb according to the docs: <a href="http://docs.docker.com/userguide/dockervolumes/#backup-restore-or-migrate-data-volumes" rel="noreferrer">http://docs.docker.com/userguide/dockervolumes/#backup-restore-or-migrate-data-volumes</a> and this command:</p>
  
  <pre><code>docker run --volumes-from mongodb_data -v $(pwd):/backup busybox tar cvf /backup/backup.tar /mongodb_data
  </code></pre>
  
  <p>However the created tar file has just an empty <code>/mongodb_data</code> folder. The folder contains not a single file.</p>
  
  <p>Any ideas whats wrong? I am using docker 1.7 on ubuntu 14.04 LTS.</p>