In .Net Framework application made in VS (application is build and deployed by VS) I tried to access my local database from Docker using host.docker.internal but this is not resolved, when try to ping it, I get this:
Ping request could not find host host.docker.internal. Please check the name and try again.
Changing host.docker.internal to my internal IP address do work just fine (ports are exposed), but as that project is used by other people I can't use it.
hosts file in my PC contains host.docker.internal (using Management Studio did succeed).
I already tried downgrading Docker for Windows to version 2.0.0.3.
I tried few images provided by Microsoft (4.7 1803 and 4.8 1803 1903 and latest).
I tried adding to compose network_mode: "host"
Docker Compose is same as generated by VS so only: project, image and build with context and dockfile
Docker Compose Override:
version: '3.4'
{code}services:
xxx:
ports:
- "80"
depends_on:
- xxx.webapi
xxx.webapi:
ports:
- "80"
networks:
default:
external:
name: nat
Dockerfile
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-1903
ADD https://download.microsoft.com/download/C/9/E/C9E8180D-4E51-40A6-A9BF-776990D8BCA9/rewrite_amd64.msi /install/rewrite_amd64.msi
RUN msiexec.exe /i c:\install\rewrite_amd64.msi /passive
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .