I'm using docker to deploy my web application in my VPS (Ubuntu 18.04).
Here is my Dockerfile
FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /app
RUN dotnet restore
RUN dotnet build
EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
ENV ASPNETCORE_ENVIRONMENT docker
ENTRYPOINT [ "dotnet", "watch", "run", "--no-restore", "--urls", "http://*:5000"]
I also use Nginx and it works perfectly (http://www.onserassure.com)
It's already running with SQLite but I wanted to use SQL Server. So I found this tutorial to use SQL Server on Mac/Linux : https://www.phillipsj.net/posts/working-with-sql-server-on-linux-for-dotnet-development And it worked fine. I ran my SQL Server container with :
docker run -d --name sql_server_demo -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=XXXXX' -p 1433:1433 microsoft/mssql-server-linux
And used this connection string :
"Server=localhost;Database=Movies;User Id=sa;Password=XXXXXXX;"
So it worked fine with a simple dotnet run
in local
But when I put my app in a container (even in local), it can't access to my database...
I don't really understand why. I'm testing on my Macbook and my VPS is on Linux