Entity framework 7 with Microsoft SQL server not working in Docker

I am using EntityFramework 7 with Microsoft SQL server in asp.net 5. I am using EntityFramework.MicrosoftSqlServer: 7.0.0-rc1-final.
When I run my web application in visual studio everything it works as expected.
But, I want to run my application in Docker. I am using official Docker image for running asp.net application:
microsoft/aspnet:1.0.0-rc1-update1-coreclr

Here is my dockerfile:

  • How to publish Visual Studio ASP.NET 5 projects to Docker Hub?
  • In Docker, can I allow IIS to output detailed errors in a container running an MVC project?
  • How to copy image into VS2015 in order to amend code
  • Docker for windows - Internal server error
  • Visual studio 2017 docker error running app
  • How to setup ASP.NET Web Application with Docker container
  • FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr

    COPY project.json /app/

    WORKDIR /app

    RUN [“dnu“, “restore”]

    COPY . /app

    ARG CONTAINER_PORT=5000

    ARG SERVER_URLS=http://*:$CONTAINER_PORT

    ENV SERVER.URLS $SERVER_URLS

    EXPOSE $CONTAINER_PORT

    ENTRYPOINT [“dnx”, “-p”, “project.json”, “web”]

    Build is successful in docker, but when I run application I get following error after application starts:

    Application startup exception: System.IO.FileLoadException: Could not load file or assembly ‘app, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
    [36mwebapi_1 | [0mFile name: ‘app, Culture=neutral, PublicKeyToken=null’ —> Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException: /app/Startup.cs(33,18): DNXCore,Version=v5.0 error CS1061: ‘EntityFrameworkServicesBuilder’ does not contain a definition for ‘AddSqlServer’ and no extension method ‘AddSqlServer’ accepting a first argument of type ‘EntityFrameworkServicesBuilder’ could be found (are you missing a using directive or an assembly reference?)

    The problem seems to be in ‘AddSqlServer’ command. Strange thing is that it works when built and runt from visual studio. Does anyone know something about this problem?

    Thanks.

  • Can't access docker-machine IP on Windows
  • How to copy multiple files into a docker data volume
  • IP variable expansion in Kubernetes Pod definition
  • COPY with docker but with exclusion
  • docker on mac + docker-machine. can't ctrl+c
  • How to add class A ip subnet to docker0 bridge
  • One Solution collect form web for “Entity framework 7 with Microsoft SQL server not working in Docker”

    Try explicitly sharing your drive with the Docker host. If you are using docker-machine, this is under the settings for default in Virtual Box. If you have the Docker for Windows beta, you can do it in the settings from the task bar icon. It may not be that the extension method is missing, only that Docker can’t access it.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.