title: How to analyze disk usage of a Docker container
body: <p>I can see that Docker takes 12GB of my filesystem:</p>
  
  <pre><code>2.7G    /var/lib/docker/vfs/dir
  2.7G    /var/lib/docker/vfs
  2.8G    /var/lib/docker/devicemapper/mnt
  6.3G    /var/lib/docker/devicemapper/devicemapper
  9.1G    /var/lib/docker/devicemapper
  12G     /var/lib/docker
  </code></pre>
  
  <p>But, how do I know how this is distributed over the containers?</p>
  
  <p>I tried to attach to the containers by running (the new v1.3 command)</p>
  
  <pre><code>docker exec -it &lt;container_name&gt; bash
  </code></pre>
  
  <p>and then running 'df -h' to analyze the disk usage. It seems to be working, but not with containers that use 'volumes-from'.</p>
  
  <p>For example, I use a data-only container for MongoDB, called 'mongo-data'.</p>
  
  <p>When I run <code>docker run -it --volumes-from mongo-data  busybox</code>, and then <code>df -h</code> inside the container, It says that the filesystem mounted on <code>/data/db</code> (my 'mongo-data' data-only container) uses 11.3G, but when I do <code>du -h /data/db</code>, it says that it uses only 2.1G.</p>
  
  <p>So, how do I analyze a container/volume disk usage? Or, in my case, how do I find out the 'mongo-data' container size?</p>