title: Does docker cache files/directories? If so, is it possible to force it to refresh its cache?
body: <p>Anyone know if Docker somehow caches files/file systems?  And if it does, is there a way to suppress that or force it to regenerate/refresh the cache.  I am editing my files outside my docker image, but the directory inside the docker image doesn't seem to include them in it. However, outside the docker image the &quot;same&quot; directory does include the files.  The only thing that makes sense to me is that docker has an internal &quot;copy&quot; of the directory and isn't going to the disk, so it sees an outdated copy of the directory before the file was added.</p>
  <p>Details:
  I keep my &quot;work&quot; files in a directory on a separate partition (/Volumes/emacs) on my MacBook, i.e.:</p>
  <pre><code>/Volumes/emacs/datapelago
  </code></pre>
  <p>I do my editing in emacs on the MacBook, but not in the docker container.  I have a link to that directory called:</p>
  <pre><code>/projects
  </code></pre>
  <p>And I might edit or create a file called:</p>
  <pre><code>/projects/nuc-440/qflow/ToAttribute.java
  </code></pre>
  <p>In the meantime I have a docker container I created this way:</p>
  <pre><code>docker container create -p 8080:8080 -v /Volumes/emacs/datapelago:/projects -v /Users/christopherfclark:/Users/cfclark --name nuc-440 gradle:7.4.2-jdk17 tail -f /dev/null 
  </code></pre>
  <p>I keep a shell running in that container:</p>
  <pre><code>docker container exec -it nuc-440 /bin/bash
  cd /projects/nuc-440
  </code></pre>
  <p>And after making changes I run the build/test sequence:</p>
  <pre><code>gradle clean;gradle build;gradle test
  </code></pre>
  <p>However, recently I have noticed that when I make changes, add files, they don't always get reflected inside the docker container, which of course can cause the build to fail or the test not to pass etc.</p>
  <p>Thus, this question.</p>
  <p>I'd rather not have to start/stop the container each time and instead just keep it running and tell it to &quot;refetch&quot; the projects/nuc-440 directory and its children.</p>
  <hr />
  <p>I restarted the docker container and it is now &quot;tracking&quot; file changes again.  That is I can make changes in MacOS and they are reflected inside docker with no additional steps.  I don't seem to have to continually restart it.  It must have gotten into a &quot;wierd&quot; state.  However, I don't have any useful details beyond that.   Sorry.</p>