Limit Disk usage in Docker+MongoDB
<p>I am using the official mongo Docker image to start a MongoDB container where my boot disk is limited (e.g. 10G) I configured the docker to run with Google Cloud Logging driver and was hoping Google to store all the logs and save my local disk space. However, I notice the disk continues to grow:</p>

<pre><code>$ df -h
/dev/sda1       9.9G  4.5G  4.9G  49%
</code></pre>

<p>As I digged deeper I realized the size of docker containers seems to be growing over time.</p>

<pre><code>$ sudo du -sh /var/lib/docker/
3.6G    /var/lib/docker/
</code></pre>

<p>However, I can't go further as somehow I can't access the directories within. </p>

<p>If I go inside the docker and <code>du -sh</code> the root, I don't find any suspicious directories occupying space.</p>

<p>So my problem is how do I find out where the disk space is used and how do I eliminate it.</p>

<p>My docker startup command (shown without project options)</p>

<pre><code>docker run -d --log-driver=gcplogs mongo mongod
</code></pre>

<p>EDIT: I noticed the size growing has stopped at 4.5GB from ~3GB for a while. So I supposed it has reached some equilibrium now.</p>