title: How to list files in a stopped Docker container
body: <p><a href="https://stackoverflow.com/questions/34429757/how-to-copy-file-to-stopped-docker-container">This question</a> shows how to copy files out of a stopped container.  This requires that I know the full path to the file including its file name.  I know the directory I want to copy a file out of, but I do not know its file name since that is generated dynamically.  How do I <em><strong>list</strong></em> the files in a directory in a stopped Docker container?</p>
  <p>The following Docker command works great if the Docker container is running.  But, it fails if the Docker container is stopped.</p>
  <pre><code>docker exec --privileged MyContainer ls -1 /var/log
  </code></pre>
  <p>Note: The files are not stored in a persistent volume.</p>