title: Confused by Docker directory structure (file not found error)
body: <p>I am getting a file not found error and even though I manually create the file in the Docker container it still reports as not found. Solving this is of course complicated by me being new to Docker and learning how everything in the docker world works.</p>
  <p>I am using Docker Desktop with a .net core application.</p>
  <p>In the .Net application I am looking for the file to use as an email template. All of this works when I run outside a Docker container but inside docker it fails with file not found.</p>
  <pre><code>public async Task SendEmailAsyncFromTemplate(...)
  {
     ...snipped for brevity
          
          string path = Path.Combine(Environment.CurrentDirectory, @$&quot;Infrastructure\Email\{keyString}\{keyString}.cshtml&quot;);
  
          _logger.LogInformation(&quot;path: &quot; + path);
  
          //I added this line because when I connect to docker container the root 
          //appears to start with infrastructure so I chopped the app part of
          var fileTemplatePath = path.Replace(@&quot;/app/&quot;, &quot;&quot;);
  
          _logger.LogInformation(&quot;filePath: &quot; + fileTemplatePath);
  </code></pre>
  <p>The container log for the above is</p>
  <pre><code>[12:40:09 INF] path: /app/Infrastructure\Email\ConfirmUser\ConfirmUser.cshtml
  [12:40:09 INF] filePath: Infrastructure\Email\ConfirmUser\ConfirmUser.cshtml
  </code></pre>
  <p>As mentioned in the comments I did this because when I connect to the container the root shows Infrastructure as the first folder.</p>
  <p><a href="https://i.stack.imgur.com/wGwsv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wGwsv.png" alt="enter image description here" /></a></p>
  <p>So naturally I browse into Infrastructure and the Email folder is missing. I have asked a separate <a href="https://stackoverflow.com/questions/69441227/docker-compose-copies-one-folder-but-not-other">SO question here about</a> why my folders aren't copying.</p>
  <p>OK my Email files and folders under Infrastructure are missing. So to test this out I manually created the directory structure and create the cshtml file using this command:</p>
  <pre><code>docker exec -i addaeda2130d sh -c &quot;cat &gt; Infrastructure/Email/ConfirmUser/ConfirmUser.cshtml&quot; &lt; ConfirmUser.cshtml
  </code></pre>
  <p>I chmod the file permissions to 777 just to make sure the application has write access and then added this debugging code.</p>
  <pre><code>_logger.LogInformation(&quot;ViewRender: &quot; + filename);
  
  try
  {
     _logger.LogInformation(&quot;Before FileOpen&quot;);
     var fileExista = File.Exists(filename);
  
     _logger.LogInformation(&quot;File exists: &quot; + fileExista);
  
     var x = File.OpenRead(filename);
  
    _logger.LogInformation(&quot;After FileOpen:&quot;, x.Name);
  </code></pre>
  <p>As you can see from the logs it reports the file does NOT exist even though I just created it.</p>
  <pre><code>[12:40:09 INF] ViewRender: Infrastructure\Email\ConfirmUser\ConfirmUser.cshtml
  [12:40:09 INF] Before FileOpen
  [12:40:09 INF] File exists: False
  </code></pre>
  <p>Well, the only logical conclusion to this is I don't know / understand what is going on which is why I am reaching out for help.</p>
  <p>I have also noted that if I stop the container (not recreate just stop) and then start it all my directories and files I created are gone.</p>
  <p>So...are these directories / files in memory and not on &quot;disk&quot; and I need to commit the changes somehow?</p>
  <p>It would seem to make sense as the application code is looking for the files on disk and if they are in memory then they wouldn't be found but in Googling, Pluralsight courses etc. I can't find any mention of this.</p>
  <p>Where can I start looking in order to figure this out?</p>