<p>I run the following docker image:</p>
<pre><code>docker run -d -v home/myap:/home/node/appl example1 :latest
</code></pre>
<p>Let's assume that we run container <code>example1</code> and it writes extensively into /home/node/app directory (1 GB every 1 minute). So in 10 minutes, we have written 10 GB.</p>
<p>If the docker container wasn't restarted am I right that size of the directory <code>home/myapp</code> as well as the size of docker container <code>/home/node/app</code> will be 10GB? So did our write operation take in total 20 GB of space?</p>
<p>Is there a way to keep the size inside of a docker container restricted, for example, no more than 3GB? Would Swarm or K8s help us with that?</p>

illuminato
<blockquote>
<p>Am I right that size of the directory home/myapp as well as the size of docker container /home/node/app will be 10GB?</p>
</blockquote>
<p>No, you are not. Your <code>home/myapp</code> directory will be mounted into the container – so instead of writing into the container, it will write into your <code>home/myapp</code> directory.</p>
<p>However, <em>from the container's perspective</em>, <code>/home/node/app</code> will be 10Gi in size – and say so if you jump into the container and have a look.</p>
<p>This follows UNIX mechanics, where you have a virtual file system, and storage mediums are mounted to different paths inside this virtual file system. In your case, said storage medium is the file path <code>home/myapp</code>, which is mounted to <code>/home/node/app</code>.</p>
