title: Docker: dotnet ef database update fails
body: <p>I've just started using EF on my project, and the <code>docker ef database update</code> command runs perfectly, when I run it locally from the project's folder.</p>
  
  <p>However, when I am trying to deploy the application using docker, it fails at:</p>
  
  <p><code>RUN dotnet ef database update</code></p>
  
  <p>I get the following error message:</p>
  
  <pre><code>An error occurred while accessing the IWebHost on class 'Program'. Continuing without the application service provider. Error: The configuration file 'appsettings.json' was not found and is not optional. The physical path is '/src/WebApp/FileManager.WebApp/bin/Debug/netcoreapp2.2/appsettings.json'.
  Unable to create an object of type 'FileManagerDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
  The command '/bin/sh -c dotnet ef database update' returned a non-zero code: 1
  </code></pre>
  
  <p>My Program.cs looks like this (default):</p>
  
  <pre><code>public class Program
  {
      public static void Main(string[] args)
      {
          CreateWebHostBuilder(args).Build().Run();
      }
  
      public static IWebHostBuilder CreateWebHostBuilder(string[] args) =&gt;
          WebHost.CreateDefaultBuilder(args)
              .UseStartup&lt;Startup&gt;();
  }
  </code></pre>
  
  <p>My dockerfile looks like this:</p>
  
  <pre><code>FROM microsoft/dotnet:2.2.0-aspnetcore-runtime AS base
  WORKDIR /app
  EXPOSE 80
  
  FROM microsoft/dotnet:2.2.103-sdk AS build
  WORKDIR /src
  COPY ["src/filemanager.csproj", "WebApp/FileManager.WebApp/"]
  RUN dotnet restore "WebApp/FileManager.WebApp/filemanager.csproj"
  WORKDIR /src/WebApp/FileManager.WebApp
  COPY . .
  RUN dotnet build "filemanager.csproj" -c Release -o /app
  RUN dotnet ef database update
  
  FROM build AS publish
  RUN dotnet publish "filemanager.csproj" -c Release -o /app
  
  FROM node:11.6.0-alpine as nodebuild
  WORKDIR /src
  COPY ["src/client", "ClientApp/"]
  WORKDIR /src/ClientApp
  RUN yarn
  RUN yarn build
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app .
  COPY --from=nodebuild /src/ClientApp/build /app/wwwroot
  ENTRYPOINT ["dotnet", "filemanager.dll"]
  </code></pre>
  
  <p>What am I doing wrong? It successfully deploys if I remove the database update.</p>