title: run pg_dump in a docker container and output file to host
body: <p>We typically have to pg_dump from multiple different versions of databases. I want to run the command inside a Docker container with the right Postgres version and have the dump output to my files rather than the container.</p>
  
  <p>I thought I'd achieve it like so;</p>
  
  <pre><code>docker run -it postgres:9.6.6-alpine pg_dump --file backupFile.bak --dbname=CONNECTIONSTRING --verbose --format=c --blobs &gt; backupFile.bak
  </code></pre>
  
  <p>however this just outputs the terminal output of the pg_dump command to a file, not the actual dump. I end up with a local file that's just the verbose log of the command.</p>
  
  <p>What am I missing?</p>