title: Run a script into a container then copy files to host from the container
body: <p>I want to run a script against a container and copy the output files back to the host. I have few questions:</p>
  
  <ul>
  <li><p>Does the script need to be inside the container in order to run OR I can have the script in the host and still can run it against the container?</p></li>
  <li><p>Copying files is available through cp command which only available in docker. Now in the container 'docker cp' is not available. So if the script is running inside the container how it can copy files to the host?</p></li>
  </ul>
  
  <p>What I am trying to do is the following (my running container has mongodb):</p>
  
  <ul>
  <li>Export certain collections to json files</li>
  <li>Copy the resulted files to the host</li>
  </ul>
  
  <p>As you can see some commands are available in the container such as 'mongoexport' and some are available in the host only like 'docker cp'.</p>