title: Every query on SQLite DB using EF Core in Docker is very slow, unless there is an explicit call to OpenConnection
body: <p>I am running a simple .NET Core 3.1 web application on localhost. The web application is running in a Docker Linux container (my host OS is Windows 10). The SQLite database used by the web application is connected using EF Core, is almost empty and very small at 60Kb, each table having 20 records or less, and is stored on the host and mounted for the container using following command:</p>
  <pre><code>--mount type=bind,source='SomeDummyHostPath',target=/mnt/hostFolder
  </code></pre>
  <p>The problem is that every query executed on DBContext runs very slow (~2s for reading 2 rows). When I run the application outside of the Docker container, everything runs smoothly (meaning that the same query is executed in ~1ms).</p>
  <p>What is strange is, after invoking <code>dbContext.Database.OpenConnectionAsync()</code> before every call to EF's DBSets, every query in the Docker container runs quickly (a few milliseconds).</p>
  <p>Why is the performance so bad in this scenario? Is there any way to improve it without the explicit call to <code>OpenConnectionAsync</code> before every query?</p>